访问EntityManager时出错 - openjpa - WAS liberty profile [英] Error while accessing EntityManager - openjpa - WAS liberty profile

查看:203
本文介绍了访问EntityManager时出错 - openjpa - WAS liberty profile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正致力于 WebSphere Application Server Liberty Profile 8.5.5.7上的openjpa项目。,数据库为 MySQL

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:


引起:javax.ejb.EJBException:参见嵌套异常;嵌套异常是:java.lang.Exception:请参阅com.ibm.ejs.container.util.ExceptionUtil.EJBException(ExceptionUtil.java:461)中的嵌套Throwable

... 27更多

引起:java.lang.Exception:请参阅com.ibm.ejs.container.util.ExceptionUtil.Exception(ExceptionUtil.java:317)中嵌套的Throwable

... 27更多


引起: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 class]

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]

目前我正在使用以下依赖项:org.apache.openjpa:openjpa-all-2.4.0

currently I'm using the following dependencies:org.apache.openjpa:openjpa-all-2.4.0

在部署期间,我看到以下堆栈跟踪

During deployment, I see the following stack trace


[错误] 458 appname INFO [Default Executor-thread-16] openjpa.jdbc.JDBC - 使用字典类org.apache.openjpa.jdbc.sql.MySQLDictionary(MySQL 5.6.25-0ubuntu0.15.04.1,MySQL-AB JDBC Driver mysql- connector-java-5.0.8(修订版:$ {svn.Revision}))。


[错误] 502 appname INFO [默认Executor-thread-16] openjpa.jdbc.JDBC - 使用JDBC驱动程序MySQL-AB JDBC驱动程序版本mysql-connector-java-5.0.8(版本:$ {svn.Revision})连接到MySQL 5.5版。

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

在server.xml中添加了以下功能

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>

假设它是兼容性问题,我使用旧版本的openjpa直到2.2.1。
来自server.xml的已禁用的jpa-2.1功能

但是没有运气。

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



更新:
感谢您的更新。
将server.xml更新为


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>

仍然无法选择EntityManager。

That still is Not able to pick the EntityManager.


[错误]错误处理期间发生错误,放弃!
嵌套异常是:javax.ejb.EJBException:参见嵌套异常;嵌套异常是:java.lang.NullPointerException同时使用params []调用public void foo()。
$
[错误] SRVE0777E:应用程序类'org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver抛出异常。 onMessage:116'
java.lang.RuntimeException:org.apache.cxf.interceptor.Fault:嵌套异常是:javax.ejb.EJBException:参见嵌套异常;嵌套异常是:java.lang.NullPointerException同时使用params []调用public void foo()。

at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:116)
在[内部类]由
引起:org.apache.cxf.interceptor.Fault:嵌套异常是:javax.ejb.EJBException:参见嵌套异常;嵌套异常是:
java.lang.NullPointerException在调用public void foo()时使用params []。

at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker。 java:167)
$
... 1更多

引起:javax.ejb.EJBTransactionRolledbackException:嵌套异常是:javax.ejb.EJBException:参见嵌套异常;嵌套异常是:java.lang.NullPointerException
at com.ibm.ejs.container.BusinessExceptionMappingStrategy.mapCSIException(BusinessExceptionMappingStrategy.java:124)
at [internal classes]


推荐答案

您已指定jpa-2.1,但OpenJPA不支持JPA 2.1。 WebSphere附带的JPA 2.1提供程序是EclipseLink。您需要从persistence.xml中删除对OpenJPA的引用并使用默认的EclipseLink(尽管有一些已知的行为更改),或者如Gas建议的那样,您需要将webProfile-7.0和jpa-2.1替换为jpa-2.0如果你想继续使用OpenJPA。

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.

这篇关于访问EntityManager时出错 - openjpa - WAS liberty profile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆