问题描述
我目前正致力于 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:
目前我正在使用以下依赖项: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
但是这不会中止我的部署过程,我仍然可以使用我的服务。
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.
推荐答案
您已指定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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!