Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Websphere EntityManagerFactory creation problem

2,357 views
Skip to first unread message

buraks...@gmail.com

unread,
Nov 18, 2008, 4:36:44 AM11/18/08
to
Hello,

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.

buraks...@gmail.com

unread,
Nov 18, 2008, 6:30:24 AM11/18/08
to
btw i have managed to integrate the latest openjpa implementation the same way. i have checked it out from its svn repo and it works fine with websphere.

michal...@altkom.pl

unread,
Nov 25, 2008, 12:05:08 PM11/25/08
to
hello, I have got exactly the same issue. have you managed to resolve it?

buraks...@gmail.com

unread,
Nov 26, 2008, 4:37:56 PM11/26/08
to
michael,

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.

Dror

unread,
Nov 27, 2008, 6:57:22 AM11/27/08
to
On Nov 18, 11:36 am, buraksevi...@gmail.com wrote:
> Hello,
>
> 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-ser...

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

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

dr...@alphacsp.com

unread,
Nov 27, 2008, 7:30:37 AM11/27/08
to
I have the same issue. After some tracing I've found the reason to be:

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();

dr...@alphacsp.com

unread,
Nov 27, 2008, 9:15:53 AM11/27/08
to
The solution is actually very easy, just remove the ejb3-persistence jar (containing the JPA interfaces) from the EAR and let Websphere load it from the parent classloader.

buraks...@gmail.com

unread,
Dec 1, 2008, 2:42:14 AM12/1/08
to
Dror-Bereznitsky,

It didn't work for me.

-bs

dr...@alphacsp.com

unread,
Dec 2, 2008, 10:14:39 AM12/2/08
to
Are you getting the same error code or another one?
Is your application class loader order configured as "parent-last"?
If you have other Hibernate errors they will be wrapped and hidden by a custom exception. You will also get another error code: CWWJP0015E.

buraks...@gmail.com

unread,
Dec 3, 2008, 3:07:34 AM12/3/08
to
Hi,

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.

Dror Bereznitsky

unread,
Dec 3, 2008, 4:27:06 AM12/3/08
to
From the log file the problem seems to be the following:

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

buraks...@gmail.com

unread,
Dec 4, 2008, 2:53:46 AM12/4/08
to
I have checked logs/ffdc. There are some interesting entries recorded on Dec 1 regarding hibernate in server1_exception.log file. I am attaching it here. But altough I deployed and ran the same module today, there were no logs about the same problem. How can I trace Websphere JPA for more detailed logging?

Dror Bereznitsky

unread,
Dec 9, 2008, 9:07:37 AM12/9/08
to
logs and trace
2) Choose your server
3) Diagnostic trace service
4) Change log detail levels
5) Set the logging level for "com.ibm.ws.jpa.*" to "All messages and traces"
6) restart Websphere
0 new messages