我们的项目有多个EJB模块,我们想在它们之间共享一个单一的
我们将
为什么WebLogic没有读取EAR内部的
在运行代码时,我们会收到以下错误:找不到PU(可用的持久化单元:[])。
我们正在使用WebLogic 10.3.6,它使用的是JPA 1.0和随附的TopLink/EclipseLink。
persistence.xml
文件。我们将
persistence.xml
文件放置在EAR的META-INF目录中,但是持久化单元在运行时不可用。似乎文件从未被读取,因为我们强制使用了不正确的类和jar文件,但是什么也没有发生。为什么WebLogic没有读取EAR内部的
persistence.xml
文件?在运行代码时,我们会收到以下错误:找不到PU(可用的持久化单元:[])。
Caused By: java.lang.IllegalArgumentException: No persistence unit named 'em' is available in scope ejb1-module.jar. Available persistence units: []
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="system-unit" transaction-type="JTA">
<jta-data-source>sysmtem-ds</jta-data-source>
<jar-file>../ejb1-module.jar</jar-file>
<class>...</class>
<class>...</class>
<class>...</class>
</persistence-unit>
</persistence>
结构(持久性单元放置在EAR内部)
EAR +
|- META-INF +
| - persistence.xml
|- ejb1-module.jar
|- ejb2-module.jar
|- ejb3-module.jar
我们正在使用WebLogic 10.3.6,它使用的是JPA 1.0和随附的TopLink/EclipseLink。