[hibernate-issues] [Hibernate-JIRA] Resolved: (EJB-201) Ejb3Configuration should output a warning if no persistence.xml is found

Emmanuel Bernard (JIRA) noreply at atlassian.com
Mon Aug 28 19:18:25 EDT 2006


     [ http://opensource.atlassian.com/projects/hibernate/browse/EJB-201?page=all ]
     
Emmanuel Bernard resolved EJB-201:
----------------------------------

    Fix Version: 3.2.0.cr2
     Resolution: Fixed
      Assign To: Emmanuel Bernard

Thnaks,
I've added an info level log

> Ejb3Configuration should output a warning if no persistence.xml is found
> ------------------------------------------------------------------------
>
>          Key: EJB-201
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-201
>      Project: Hibernate Entity Manager
>         Type: Improvement

>   Components: EntityManager
>     Versions: 3.2.0.cr1
>  Environment: Any Environment with missing persistence.xml or bad ClassLoaders
>     Reporter: René Treffer
>     Assignee: Emmanuel Bernard
>      Fix For: 3.2.0.cr2

>
> Original Estimate: 30 minutes
>         Remaining: 30 minutes
>
> If persistence.xml can't be found javax.ejb.Persistence return's "No Persistence 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 might have saved me hours of bugtracking.
> A sample Trace:
> 93676 [btpool0-20] INFO  org.hibernate.ejb.Version  - Hibernate EntityManager 3.2.0.CR1
> 93712 [btpool0-20] INFO  org.hibernate.cfg.annotations.Version  - Hibernate Annotations 3.2.0.CR1
> 93729 [btpool0-20] INFO  org.hibernate.cfg.Environment  - Hibernate 3.2 cr2
> 93736 [btpool0-20] INFO  org.hibernate.cfg.Environment  - hibernate.properties not found
> 93739 [btpool0-20] INFO  org.hibernate.cfg.Environment  - Bytecode provider name : cglib
> 93752 [btpool0-20] INFO  org.hibernate.cfg.Environment  - using JDK 1.4 java.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 
> java.lang.ExceptionInInitializerError
> ......
> Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named losem
>         at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:41)
>         at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
>         at de.rtjava.los.pmanager.PersistenceManager.<clinit>(PersistenceManager.java:58)
>         ... 29 more
> Good luck and a big thank-you fr Hibernate!

-- 
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





More information about the hibernate-issues mailing list