将 eclipselink 与 jboss eap 6 集成时的 stackoverflow

stackoverflow while integrating eclipselink with jboss eap 6

我正在尝试部署一个配置了 eclipse link 的应用程序作为 jbosss eap 6.3 上的 jpa 提供程序 但 EclipseLink 和 jboss 之间似乎存在问题,因为我在部署

时遇到 Whosebug 错误
Failed to define class org.eclipse.persistence.internal.weaving.WeaverLogger in Module "deployment.test-service.war:main" from Service Module Loader: java.lang.WhosebugError
    at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_74]
    at org.jboss.as.server.deployment.module.VFSResourceLoader.getClassSpec(VFSResourceLoader.java:131) [jboss-as-server-7.4.1.Final-redhat-3.jar:7.4.1.Final-redhat-3]
    at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:268) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:92) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.jboss.modules.Module.loadModuleClass(Module.java:568) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.eclipse.persistence.internal.jpa.weaving.PersistenceWeaver.transform(PersistenceWeaver.java:100)
    at org.jboss.as.jpa.classloader.JPADelegatingClassFileTransformer.transform(JPADelegatingClassFileTransformer.java:48) [jboss-as-jpa-7.4.1.Final-redhat-3.jar:7.4.1.Final-redhat-3]
    at org.jboss.as.server.deployment.module.DelegatingClassFileTransformer.transform(DelegatingClassFileTransformer.java:60) [jboss-as-server-7.4.1.Final-redhat-3.jar:7.4.1.Final-redhat-3]
    at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:474) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:277) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:92) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.jboss.modules.Module.loadModuleClass(Module.java:568) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.4.Final-redhat-1]
    at org.eclipse.persistence.internal.jpa.weaving.PersistenceWeaver.transform(PersistenceWeaver.java:100)

我需要向 jboss(standalone.xml) 添加一些配置吗?

有我的persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="unit" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>
        <properties>

            <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
            <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://*****" />
            <property name="javax.persistence.jdbc.user" value="*****" />
            <property name="javax.persistence.jdbc.password" value="****" />

            <!-- EclipseLink should create the database schema automatically -->
            <property name="eclipselink.ddl-generation" value="create-tables" />
            <property name="eclipselink.ddl-generation.output-mode" value="database" />
            <property name="eclipselink.logging.level" value="SEVERE"/>                
        </properties>

    </persistence-unit>
</persistence>

我的pom.xml(这个项目将是另一个项目的依赖项)

  <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <groupId>com.maventest</groupId>
            <artifactId>test-app</artifactId>
            <version>0.0.1-SNAPSHOT</version>
            <relativePath>../test-app</relativePath>
        </parent>
        <artifactId>test-repository</artifactId>
        <packaging>jar</packaging>

        <dependencies>
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>apache-log4j-extras</artifactId>
                <version>1.2.17</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.persistence</groupId>
                <artifactId>org.eclipse.persistence.jpa</artifactId>
                <version>2.6.2</version>
            </dependency>
            <dependency>
                <groupId>javax.transaction</groupId>
                <artifactId>jta</artifactId>
                <version>1.1</version>
            </dependency>
            <dependency>
                <groupId>postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>9.1-901-1.jdbc4</version>
            </dependency>

        </dependencies>
    </project>

如有任何建议,我们将不胜感激 非常感谢

感谢 Chris 的回答,我设法 运行 jboss eap 6 和 EclipseLink 通过在 [=35] 中集成 eclipse link 模块=] eap

我需要创建一个新文件夹:JBOSS_ HOME\modules\org\eclipse\persistence\main 并复制 eclipselink.jar 到里面。然后我需要创建 module.xml 关联的

  <?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.eclipse.persistence">
   <resources>
      <resource-root path="eclipselink.jar" />
   </resources>
   <dependencies>
      <module name="javax.api" />
      <module name="javax.persistence.api" />
      <module name="javax.transaction.api" />
      <module name="javax.validation.api" />
      <module name="javax.xml.bind.api" />
      <module name="org.antlr" />
      <module name="org.apache.commons.collections" />
      <module name="org.dom4j" />
      <module name="org.javassist" />
      <module name="org.jboss.logging" />
   </dependencies>
</module>

完成教程:https://docs.jboss.org/author/display/WFLY8/JPA+Reference+Guide#JPAReferenceGuide-UsingEclipseLink and http://www.eclipse.org/eclipselink/documentation/2.5/solutions/jboss002.htm

此外尽管我的服务器 运行 在那之后很顺利,但是在尝试保留任何数据后我遇到了一个新错误 "object is not a known entity type"

问题是因为在 persistence.xml 我有行 <exclude-unlisted-classes>false</exclude-unlisted-classes>

eclipselink 和 jboss eap

之间似乎存在类加载问题

我需要通过 <class> 属性

明确声明实体