I am assigned a decision analysis resolution task for a new project in my company. I am evaluating Websphere Application Server v7.0 with Hibernate as JPA provider, and having some integration troubles.
Websphere cannot create an EntityManagerFactory and gives the following error.
{code}
CWWJP0009E: The server cannot create an EntityManagerFactory factory for the Frameworks persistent unit from the org.hibernate.ejb.HibernatePersistence provider in file:/C:/Documents and Settings/burak/IBM/rationalsdp/workspace/Frameworks/ejbModule/ module.{code}
I found out that there are other people having exactly the same problem but I am not sure whether the source of the problem is a mistake by me, a bug in Websphere or Hibernate. Also you can check this post: http://groups.google.com/group/ibm.software.websphere.application-server/browse_thread/thread/8b8dc2b4f24b47bd/d6f9a75874fe19f0?lnk=raot
I have configured my persistence.xml as follows:
{code}
org.hibernate.ejb.HibernatePersistence
jdbc/OracleJDBCDriverXADataSource
gov.tubitak.frameworks.domain.Framework
true
{code}
And I have added the hibernate core, annotations and entitymanager jars to my EAR project.
Because of this problem EntityManager injection fails:
{code}@PersistenceContext private EntityManager entityManager;{code}
Thanks in advance.
unfortunately no. people are having the same problem since the 6.1 release (with EJB 3.0 feature pack) but no solution provided. see this post: http://groups.google.com/group/ibm.software.websphere.application-server/browse_thread/thread/8b8dc2b4f24b47bd/d6f9a75874fe19f0?lnk=raot&pli=1
as i have said before i have managed to integrate the lastest openjpa nightly build the same way but it doesn't work for hibernate and toplink. openjpa is not a mature orm framework, i think it is not reliable at this stage. for example i come across a severe bug even prevents doing basic persistence operations.
I have the same issue with Websphere 7.0 and Hibernate.
Did some tracing to figure out what is going on and got the following
information:
JPAPUnitInfo 3 Caught unexpected
exception:java.lang.ClassCastException:
org.hibernate.ejb.HibernatePersistence incompatible with
javax.persistence.spi.PersistenceProvider
JPAPUnitInfo E CWWJP0009E: The server cannot create an
EntityManagerFactory factory for the custdb persistent unit from the
org.hibernate.ejb.HibernatePersistence provider in jar:file:/C:/IBM/
WebSphere/AppServer7/profiles/AppSrv01/installedApps/alphacsp-
drorbNode03Cell/Sample EJB 3.0 application.ear/ejb-sample-1.0.0-
SNAPSHOT.jar!/ module.
I guess that JPAPUnitInfo has the Websphere version of
javax.persistence.spi.PersistenceProvider in his classloader and not
using the one from ejb3-persistence-1.0.1.GA.jar (for Hibernate entity
manager 3.3.2).
java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence incompatible with javax.persistence.spi.PersistenceProvider
at com.ibm.ws.jpa.management.JPAPUnitInfo.createEMFactory(JPAPUnitInfo.java:1416)
at com.ibm.ws.jpa.management.JPAPUnitInfo.createEntityManagerFactory(JPAPUnitInfo.java:1292)
at com.ibm.ws.jpa.management.JPAPxmlInfo.extractPersistenceUnits(JPAPxmlInfo.java:393)
at com.ibm.ws.jpa.management.JPAScopeInfo.processPersistenceUnit(JPAScopeInfo.java:140)
at com.ibm.ws.jpa.management.JPAApplInfo.processModulePUs(JPAApplInfo.java:169)
at com.ibm.ws.jpa.management.JPAComponentImpl.startingDeployedModule(JPAComponentImpl.java:878)
at com.ibm.ws.jpa.management.JPAComponentImpl.stateChanged(JPAComponentImpl.java:722)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.stateChanged(ApplicationMgrImpl.java:1114)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectEvent(DeployedApplicationImpl.java:1296)
at com.ibm.ws.runtime.component.DeployedModuleImpl.setState(DeployedModuleImpl.java:213)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:608)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:938)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:740)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2092)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:437)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:122)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:380)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$300(CompositionUnitMgrImpl.java:105)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:928)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:349)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)
Caused by the following line of code (JPAUnitInfo):
[1416] PersistenceProvider provider = (PersistenceProvider)providerClass.newInstance();
It didn't work for me.
-bs
I am getting the same error code, and not CWWJP0015E. And yes, my application class loader order configured parent-last. Maybe, listing the hibernate jars will help identifying another possible conflict. Here they are:
antlr-2.7.6, asm, asm-attr, c3p0-0.9.1, cglib-2.1.3, commons-collections-2.1.1, commons-logging-1.0.4, concurrent-1.3.2, dom4j-1.6.1, ecache-1.2.3, hibernate3, hibernate-annotations, hibernate-commons-annotations, hibernate-entitymanager, hibernate-validator, javassist, log4j-1.2.11
Also there isn't anything in my SystemErr.log, but I am attaching the SystemOut.log. It is a lengthy one, but maybe it will help.
{code}[03.12.2008 09:42:39:375 EET] 00000073 InjectionBind E CWNEN0030E: The com.ibm.ws.util.JPAJndiLookupObjectFactory@cce0cce factory encountered a problem getting the object instance Reference Class Name: javax.persistence.EntityManager
Type: JPAJndiLookupInfo
Content: PuId=TubitakEar#Domain.jar#Frameworks, TubitakEar#Domain.jar#ProgrammingLanguageDaoImpl#gov.tubitak.frameworks.dao.impl.GenericDaoImpl/em, isFactory=false, isSFSB=false, PersistenceContextType=Transaction, properties=[]
binding object.{code}
Do you have any related detailed exception description in the "logs\ffdc" directory?
You should start tracing Websphere JPA to get more detailed logging.