Using JPA/Hibernate from a module
objectiser Sep 8, 2011 1:25 PMHi
I'm building a component for switchyard for deployment in AS7, where the component is delivered as an AS7 module. One of the jars in this module has a persistence.xml.
The problem is that I am getting an exception:
javax.persistence.PersistenceException: No Persistence provider for EntityManager named ode-bpel
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]
The default build for switchyard currently uses AS7.0.0.Final as its base, although I have also tried it with 7.0.1.Final, due to the changes to support hibernate 3 and 4.
With AS7.0.0.Final, the error was preceded by:
16:00:44,188 INFO [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-2) HHH00318:Could not find any META-INF/persistence.xml file in the classpath
so appeared to be classpath related due to module isolation. Not sure if anything special is required to enable JPA to locate the persistence.xml file in the module?
The module dependencies include....
<dependencies> <module name="org.hibernate"/> <module name="org.jboss.as.jpa"/> <module name="javax.api"/> <module name="javax.transaction.api"/> <module name="javax.persistence.api"/> ....
When I build against AS7.0.1.Final, I also added the module dependency "org.jboss.as.jpa.hibernate" slot "4". This resulted in the same exception, but this time the "Could not find any META-INF/persistence.xml file in the classpath" message was not present.
So not sure if the AS7.0.1 run is now finding the persistence.xml and there is another problem, or whether locating the xml file is still the problem?
Any suggestions appreciated.
Regards
Gary
-
server.log.zip 269.0 KB