-->
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.  [ 2 posts ] 
Author Message
 Post subject: J2EE Application with Java Module
PostPosted: Thu Nov 16, 2006 9:22 am 
Newbie

Joined: Mon Aug 16, 2004 8:36 am
Posts: 7
Location: Canada
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

EntityManager 3.2.0GA

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
Exception thrown : javax.persistence.PersistenceException: No Persistence provider for EntityManager named healthClubMembers
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
at org.myhealthclub.transaction.utility.EntityManagerUtility.getEntityManager(EntityManagerUtility.java:19)

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


My problem is this. I have a proper J2EE Application structure /project (Using Eclipse WTP 1.5). Where I have an EAR Project a Web Project and a "utility" Java Project. I do all the "JPA stuff" in the Java Project. When the web project invokes logic from the Java Project, based on the exception I am getting I believe the persistence.xml is not being found. Yet if I put all the code in the Web Project things work fine.

The reason I want to separate and put all the JPA stuff in a separate Java project, is because it is "utility" code, that I want to use across multiple other J2EE modules, Web, EJB, etc. I don't want all this logic collapsed into a single Web Module. However, unless I do so, it seems that the classloaders, or whatever can't find the persistence.xml.

Any ideas, is this a known bug. By the way out of interest, this same behaviour/problem exists with the Toplink JPA reference implementation as well (although the exception is different).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 23, 2006 1:11 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
your app server is messing around and we probably can't extract the jar name.
Every JPA implementation do more or less
Code:
Enumeration<URL> xmls = Thread.currentThread()
               .getContextClassLoader()
               .getResources( "META-INF/persistence.xml" );
         if ( ! xmls.hasMoreElements() ) {
            log.info( "Could not find any META-INF/persistence.xml file in the classpath");
         }


If it returns nothing in your app server, you won't make it work

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.