-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: No Persistence provider for EntityManager in tomcat
PostPosted: Wed Apr 05, 2006 1:58 pm 
Newbie

Joined: Tue Aug 09, 2005 3:03 pm
Posts: 14
I get "javax.persistence.PersistenceException: No Persistence provider for EntityManager named SSManager" when I do
"emf = Persistence.createEntityManagerFactory("SSManager");"
out of a tomcat 5.
The structure of the code is as follows:
ss1.jar:
com ---> code accessing emf
META-INF ---> persistence.xml

The jar itself is included in the lib dir of a war that is structured as follows:
ss1.war:
jsp ---> jsp docs
WEB-INF\lib ----> where jar resides

When I do this.getClass().getClassLoader().getResources("META-INF/persistence.xml");"
I get
C:/Program%20Files/Tomcat%205.5/
webapps/ss1/WEB-INF/lib/ss1.jar!/META-INF/persistence.xml
which is the correct location for my persistence.xml.

I would appreciate any help.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 16, 2006 11:52 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
and where are your hibernate entity manager jars?
did you specify a persistence provider in persistenc.xml?

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 9:56 pm 
Newbie

Joined: Tue Aug 09, 2005 3:03 pm
Posts: 14
Emmanuel,

I included the jars under in the lib directory of my war file (WEB-INF\lib).

here is my persistence.xml

<entity-manager>
<name>SSManager</name>

<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost/mydb"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="NONE"/>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
<property name="hibernate.ejb.cfgfile" value="/hibernate.cfg.xml"/>
</properties>
<entity-manager>

Any ideas?

Khalid


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 27, 2006 9:48 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
by doing
Thread.currentThread().getContextClassLoader().getResources( "META-INF/services/" + PersistenceProvider.class.getName() );

you should get the one included in Hibernate EntityManager, otherwise, there is an issue somewhere (ie your classpath or some classloader definition)

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.