将eclipselink与jboss eap 6集成时的stackoverflow

时间:2016-04-18 17:20:08

标签: jpa eclipselink jboss-eap-6

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

时遇到堆栈溢出错误
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select name="classType" id="classType" required>
  <option value="" disabled="true" selected="true">Select Your Class Type</option>
  <option value="Beginner">Beginner</option>
  <option value="Intermediate">Intermediate</option>
  <option value="Advanced">Advanced</option>
</select><br/>

<select name="studentType" id="studentType" required>
  <option value="" disabled="true" selected="true">Select Your Student Type</option>
  <option value="lowerLevel">Lower Level</option>
  <option value="upperLevel">Upper Level</option>
</select><br/>

我是否需要在jboss(standalone.xml)中添加一些配置?

有我的persistence.xml

Failed to define class org.eclipse.persistence.internal.weaving.WeaverLogger in Module "deployment.test-service.war:main" from Service Module Loader: java.lang.StackOverflowError
    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$1.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$1.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)

我的pom.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>

任何建议将不胜感激 非常感谢你

1 个答案:

答案 0 :(得分:1)

感谢 Chris 回答,我设法通过在jboss eap中集成eclipse链接模块来运行jboss eap 6和EclipseLink

我需要创建一个新文件夹: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-UsingEclipseLinkhttp://www.eclipse.org/eclipselink/documentation/2.5/solutions/jboss002.htm

此外,despites我的服务器在此之后运行顺利,但在尝试持久保存任何数据后我得到了一个新的错误&#34;对象不是已知的实体类型&#34;

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

似乎eclipselink和jboss eap之间存在类加载问题

我需要通过<class>属性

声明明确的实体