I’m currently working on a openjpa project on WebSphere Application Server Liberty Profile 8.5.5.7. with database being MySQL
During runtime, when I'm trying to access the Entity manager, I get the error like:
Caused by: javax.ejb.EJBException: See nested exception; nested exception is: java.lang.Exception: See nested Throwable at com.ibm.ejs.container.util.ExceptionUtil.EJBException(ExceptionUtil.java:461) ... 27 more
Caused by: java.lang.Exception: See nested Throwable at com.ibm.ejs.container.util.ExceptionUtil.Exception(ExceptionUtil.java:317) ... 27 more
Caused by: java.lang.AbstractMethodError: org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(Ljavax/persistence/SynchronizationType;Ljava/util/Map;)Ljavax/persistence/EntityManager;
at com.ibm.ws.jpa.container.v21.internal.JPA21Runtime.createEntityManagerInstance(JPA21Runtime.java:104) at [internal classes]
currently I'm using the following dependencies:org.apache.openjpa:openjpa-all-2.4.0
During deployment, I see the following stack trace
[err] 458 appname INFO [Default Executor-thread-16] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.MySQLDictionary" (MySQL 5.6.25-0ubuntu0.15.04.1 ,MySQL-AB JDBC Driver mysql-connector-java-5.0.8 ( Revision: ${svn.Revision} )).
[err] 502 appname INFO [Default Executor-thread-16] openjpa.jdbc.JDBC - Connected to MySQL version 5.5 using JDBC driver MySQL-AB JDBC Driver version mysql-connector-java-5.0.8 ( Revision: ${svn.Revision} ).
But this doesn’t abort my deployment process and I can still consume my services.
Added the following features to server.xml
<featureManager>
<feature>webProfile-7.0</feature>
<feature>localConnector-1.0</feature>
<feature>jndi-1.0</feature>
<feature>jdbc-4.1</feature>
<feature>jaxrs-2.0</feature>
<feature>jpa-2.1</feature>
</featureManager>
Assuming it to be a compatibility issue, I've used older versions of openjpa till 2.2.1.
Disabled jpa-2.1 feature from server.xml
But No luck.
Any information/ reference/ solution to the above issue is much appreciated. Thanks
Update: Thanks for the update. Updated the server.xml as
<featureManager>
<feature>localConnector-1.0</feature>
<feature>jndi-1.0</feature>
<feature>jdbc-4.1</feature>
<feature>jpa-2.0</feature>
<feature>jaxrs-2.0</feature>
<feature>jaxrsClient-2.0</feature>
<feature>ejbLite-3.2</feature>
</featureManager>
That still is Not able to pick the EntityManager.
[ERROR ] Error occurred during error handling, give up! nested exception is: javax.ejb.EJBException: See nested exception; nested exception is: java.lang.NullPointerException while invoking public void foo() with params [].
[ERROR ] SRVE0777E: Exception thrown by application class 'org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage:116' java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: nested exception is: javax.ejb.EJBException: See nested exception; nested exception is: java.lang.NullPointerException while invoking public void foo() with params [].
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:116) at [internal classes]
Caused by: org.apache.cxf.interceptor.Fault: nested exception is: javax.ejb.EJBException: See nested exception; nested exception is:
java.lang.NullPointerException while invoking public void foo() with params [].
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:167)
... 1 more
Caused by: javax.ejb.EJBTransactionRolledbackException: nested exception is: javax.ejb.EJBException: See nested exception; nested exception is: java.lang.NullPointerException at com.ibm.ejs.container.BusinessExceptionMappingStrategy.mapCSIException(BusinessExceptionMappingStrategy.java:124) at [internal classes]
You have specified jpa-2.1, but OpenJPA does not support JPA 2.1. The JPA 2.1 provider included with WebSphere is EclipseLink. You either need to remove the references to OpenJPA from your persistence.xml and use the default EclipseLink (though there are some known behavior changes), or as Gas suggested, you need to replace webProfile-7.0 and jpa-2.1 with jpa-2.0 if you want to continue to use OpenJPA.