Hi,
i am trying to integrate SmartGWT (Power 3.0) CMT in my application running on WebSphere 7.
I have a business logic EJBModule (EJBm) and a SmartGWT web application (GwtWEB).
On fetch, EMFProviderCMT tries to get the EntityManager 'persistenceEM' using a java:comp/env lookup.
The error is the following:
[03/07/12 17.36.21:774 CEST] 00000022 SystemOut O === 2012-07-03 17:36:21,774 [ : 3] DEBUG EMF - [builtinApplication.instrJPA_fetch] Initializing default EMF provider: com.isomorphic.jpa.EMFProviderCMT
[03/07/12 17.36.21:778 CEST] 00000022 SystemOut O === 2012-07-03 17:36:21,777 [ : 3] WARN RequestContext - dsRequest.execute() failed:
javax.persistence.PersistenceException: Unable to acquire entity manager.
at com.isomorphic.jpa.EMFProviderCMT.getEntityManager(EMFProviderCMT.java:157)
at com.isomorphic.jpa.EMF.getEntityManager(EMF.java:129)
at com.isomorphic.jpa.JPADataSource.execute(JPADataSource.java:422)
at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:721)
at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658)
at com.isomorphic.application.AppBase.execute(AppBase.java:491)
at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1948)
at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:199)
at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156)
at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121)
.
.
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
Caused by: javax.naming.NameNotFoundException: Name "persistenceEM" not found in context "java:comp/env".
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1178)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1095)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1233)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:395)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1276)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:364)
at com.isomorphic.jpa.EMFProviderCMT.getEntityManager(EMFProviderCMT.java:155)
... 41 more
I think the problem is the WebSphere JNDI context management. WebSphere doesn't map EntityManager objects in local JNDI context. I can manually map an EntityManager only in global JNDI context.
Is this the cause?
In this case, is there a way to force a lookup from global JNDI context?
These are my main settings:
My JPA settings in server.properties in GwtWEB:
jpa.emfProvider: com.isomorphic.jpa.EMFProviderCMT
jpa.entityManager: persistenceEM
jpa.entityManagerFactory: persistenceEMF
My test.ds.xml in GwtWEB:
<DataSource
ID="test"
serverConstructor="com.isomorphic.jpa.JPADataSource"
autoDeriveSchema="true"
schemaBean="myEntityClass"
>
</DataSource>
My ebj-jar.xml in EJBm:
<session>
<ejb-name>ProvaEAO</ejb-name>
<home>it.ccg.ejbtest.server.eao.ProvaEAOHomeRemote</home>
<remote>it.ccg.ejbtest.server.eao.ProvaEAORemote</remote>
<local-home>it.ccg.ejbtest.server.eao.ProvaEAOHomeLocal</local-home>
<local>it.ccg.ejbtest.server.eao.ProvaEAOLocal</local>
<business-local>it.ccg.ejbtest.server.eao.ProvaEAOBusinessLocal</business-local>
<business-remote>it.ccg.ejbtest.server.eao.ProvaEAOBusinessRemote</business-remote>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<persistence-context-ref>
<persistence-context-ref-name>persistenceEM</persistence-context-ref-name>
<persistence-unit-name>EJBTestPersistence</persistence-unit-name>
<persistence-context-type>Transaction</persistence-context-type>
</persistence-context-ref>
<persistence-unit-ref>
<persistence-unit-ref-name>persistenceEMF</persistence-unit-ref-name>
<persistence-unit-name>EJBTestPersistence</persistence-unit-name>
</persistence-unit-ref>
</session>
My persistence.xml in EJBm:
<persistence-unit name="EJBTestPersistence" transaction-type="JTA">
.
.
</persistence-unit>
Thanks in advance for your help.
i am trying to integrate SmartGWT (Power 3.0) CMT in my application running on WebSphere 7.
I have a business logic EJBModule (EJBm) and a SmartGWT web application (GwtWEB).
On fetch, EMFProviderCMT tries to get the EntityManager 'persistenceEM' using a java:comp/env lookup.
The error is the following:
[03/07/12 17.36.21:774 CEST] 00000022 SystemOut O === 2012-07-03 17:36:21,774 [ : 3] DEBUG EMF - [builtinApplication.instrJPA_fetch] Initializing default EMF provider: com.isomorphic.jpa.EMFProviderCMT
[03/07/12 17.36.21:778 CEST] 00000022 SystemOut O === 2012-07-03 17:36:21,777 [ : 3] WARN RequestContext - dsRequest.execute() failed:
javax.persistence.PersistenceException: Unable to acquire entity manager.
at com.isomorphic.jpa.EMFProviderCMT.getEntityManager(EMFProviderCMT.java:157)
at com.isomorphic.jpa.EMF.getEntityManager(EMF.java:129)
at com.isomorphic.jpa.JPADataSource.execute(JPADataSource.java:422)
at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:721)
at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658)
at com.isomorphic.application.AppBase.execute(AppBase.java:491)
at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1948)
at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:199)
at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156)
at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121)
.
.
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
Caused by: javax.naming.NameNotFoundException: Name "persistenceEM" not found in context "java:comp/env".
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1178)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1095)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1233)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:395)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1276)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:364)
at com.isomorphic.jpa.EMFProviderCMT.getEntityManager(EMFProviderCMT.java:155)
... 41 more
I think the problem is the WebSphere JNDI context management. WebSphere doesn't map EntityManager objects in local JNDI context. I can manually map an EntityManager only in global JNDI context.
Is this the cause?
In this case, is there a way to force a lookup from global JNDI context?
These are my main settings:
My JPA settings in server.properties in GwtWEB:
jpa.emfProvider: com.isomorphic.jpa.EMFProviderCMT
jpa.entityManager: persistenceEM
jpa.entityManagerFactory: persistenceEMF
My test.ds.xml in GwtWEB:
<DataSource
ID="test"
serverConstructor="com.isomorphic.jpa.JPADataSource"
autoDeriveSchema="true"
schemaBean="myEntityClass"
>
</DataSource>
My ebj-jar.xml in EJBm:
<session>
<ejb-name>ProvaEAO</ejb-name>
<home>it.ccg.ejbtest.server.eao.ProvaEAOHomeRemote</home>
<remote>it.ccg.ejbtest.server.eao.ProvaEAORemote</remote>
<local-home>it.ccg.ejbtest.server.eao.ProvaEAOHomeLocal</local-home>
<local>it.ccg.ejbtest.server.eao.ProvaEAOLocal</local>
<business-local>it.ccg.ejbtest.server.eao.ProvaEAOBusinessLocal</business-local>
<business-remote>it.ccg.ejbtest.server.eao.ProvaEAOBusinessRemote</business-remote>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<persistence-context-ref>
<persistence-context-ref-name>persistenceEM</persistence-context-ref-name>
<persistence-unit-name>EJBTestPersistence</persistence-unit-name>
<persistence-context-type>Transaction</persistence-context-type>
</persistence-context-ref>
<persistence-unit-ref>
<persistence-unit-ref-name>persistenceEMF</persistence-unit-ref-name>
<persistence-unit-name>EJBTestPersistence</persistence-unit-name>
</persistence-unit-ref>
</session>
My persistence.xml in EJBm:
<persistence-unit name="EJBTestPersistence" transaction-type="JTA">
.
.
</persistence-unit>
Thanks in advance for your help.
Comment