From: <no...@at...> - 2006-06-28 14:48:21
|
[ http://opensource.atlassian.com/projects/hibernate/browse/EJB-201?pag= e=3Dcomments#action_23457 ]=20 Ren=C3=A9 Treffer commented on EJB-201: ---------------------------------- Ok, this seems to be a WebApp problem, you won't find the normal META-INF/p= ersistence.xml by your ClassLoader. I've found comments of other user havin= g the same problem with Toplink and Tomcat. WEB-INF/classes/META-INF is the correct location for web applications, perh= aps hibernate could give a hint about that? > Ejb3Configuration should output a warning if no persistence.xml is found > ------------------------------------------------------------------------ > > Key: EJB-201 > URL: http://opensource.atlassian.com/projects/hibernate/browse/E= JB-201 > Project: Hibernate Entity Manager > Type: Improvement > Components: EntityManager > Versions: 3.2.0.cr1 > Environment: Any Environment with missing persistence.xml or bad ClassLo= aders > Reporter: Ren=C3=A9 Treffer > > Original Estimate: 30 minutes > Remaining: 30 minutes > > If persistence.xml can't be found javax.ejb.Persistence return's "No Pers= istence found for EntityManager <name>". > However it might help a lot of people if Ejb3Configuration could output a= warning in > public EntityManagerFactory createEntityManagerFactory(String emName, Map= integration) { > The warning might be something like "No META-INF/persistence.xml found". = In my case it looks like a Jetty6 ClassLoader problem, a simple warning mig= ht have saved me hours of bugtracking. > A sample Trace: > 93676 [btpool0-20] INFO org.hibernate.ejb.Version - Hibernate EntityMan= ager 3.2.0.CR1 > 93712 [btpool0-20] INFO org.hibernate.cfg.annotations.Version - Hiberna= te Annotations 3.2.0.CR1 > 93729 [btpool0-20] INFO org.hibernate.cfg.Environment - Hibernate 3.2 c= r2 > 93736 [btpool0-20] INFO org.hibernate.cfg.Environment - hibernate.prope= rties not found > 93739 [btpool0-20] INFO org.hibernate.cfg.Environment - Bytecode provid= er name : cglib > 93752 [btpool0-20] INFO org.hibernate.cfg.Environment - using JDK 1.4 j= ava.sql.Timestamp handling > 93923 [btpool0-20] DEBUG org.hibernate.ejb.Ejb3Configuration - Trying to= find persistence unit: losem > <<< Here should be a "WARN org.hibernate.ejb.Ejb3Configuration - No META-= INF/persistence.xml found" > followed by=20 > java.lang.ExceptionInInitializerError > ...... > Caused by: javax.persistence.PersistenceException: No Persistence provide= r for EntityManager named losem > at javax.persistence.Persistence.createEntityManagerFactory(Persi= stence.java:41) > at javax.persistence.Persistence.createEntityManagerFactory(Persi= stence.java:27) > at de.rtjava.los.pmanager.PersistenceManager.<clinit>(Persistence= Manager.java:58) > ... 29 more > Good luck and a big thank-you fr Hibernate! --=20 This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators= .jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |