Spring 4 + 休眠和 weblogic 10.3.5 上的 jpa 2.1

Spring 4 + hibernate & jpa 2.1 on weblogic 10.3.5

我可以 运行 在 weblogic 10.3.5 上使用 JPA 2.1 休眠吗?

我在 weblogic-application.xml 中指定了以下行,并将 jpa 2.1 API jar 与其他 jar 一起打包到 EAR 中。

<wls:prefer-application-packages> <wls:package-name>javax.persistence</wls:package-name> </wls:prefer-application-packages>

weblogic 如何识别 META-INF/persistence。xml 并尝试在应用程序 deployment/startup 期间使用 Eclipse Link 自动创建持久性单元。这是 weblogic classloader(应用程序 class loader 的父级)尝试加载持久性单元但失败并出现以下异常的地方。

java.lang.IllegalArgumentException:接口 javax.persistence.EntityManagerFactory 在 class 加载器

中不可见

非常感谢任何帮助。

您是否在 Weblogic 安装中启用了 JPA 2.1?

如果您参考:

https://docs.oracle.com/cd/E17904_01/web.1111/e13720/using_toplink.htm#EJBAD1309

https://docs.oracle.com/middleware/1213/wls/EJBAD/using_toplink.htm#EJBAD1309

你会注意到:

"Support for JPA 2.1 in WebLogic Server is provided as a patch because JPA 2.1 is part of the Java Platform, Enterprise Edition (Java EE) 7. Therefore, enabling JPA 2.1 support in the current release results in WebLogic Server not meeting all Java EE 6 compatibility requirements. To maintain Java EE 6 compatibility, the files required for JPA 2.1 support are not enabled by default, although they are included in a standard WebLogic Server installation."

看看@

How to Enable Java Persistence 2.0 for Weblogic 10.3.6

https://docs.oracle.com/cd/E17904_01/web.1111/e13720/using_toplink.htm#EJBAD1309