2

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]

SashankNori
  • 25
  • 1
  • 6
  • 2
    try to remove `webProfile-7.0`, add `jpa-2.0` if you want to use that version and also remove jpa jars from your application. – Gas Oct 19 '15 at 07:28

1 Answers1

4

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.

Brett Kail
  • 33,593
  • 2
  • 85
  • 90
  • Hi, this helped to an extent, but still I'm unable to pick entity manager.Please view the update where I see null pointer exception because, the EntityManager is Not getting injected to my Dao class. – SashankNori Oct 20 '15 at 05:03
  • @SashankNori The full stack trace is in messages.log. Can you post that rather than the truncated one from console.log? – Brett Kail Oct 20 '15 at 05:15
  • I observed that the feature jpa-2.0 was NOT installed or available as a feature on WAS liberty 8.5.5.7. So manually installed using the command **/wlp/bin/installUtility' install jpa-2.0** This resolved the issue. Appreciate your help in this.Thankyou! – SashankNori Oct 21 '15 at 07:05
  • @SashankNori Ah, sure, if you downloaded from wasdev.net (vs a contract from IBM), then all those downloads will be JavaEE 7 only. Glad you figured it out! – Brett Kail Oct 21 '15 at 13:32