0

我已经在 netbeans 8.1 下安装了 wildfly 9.0.2,并且因为我已经有一个配置为使用 EclipseLink 的项目,所以我尝试配置 wildfly 以使用它。到目前为止,我在 Glassfish Server 4 下开发了我的应用程序。我想开始使用 WildFly。项目是使用 maven 创建的,
这里是服务器日志:

09:54:13,557 INFO [org.jboss.as.jpa](MSC 服务线程 1-6)WFLYJPA0002:读取 AdisMngmtPU 的 persistence.xml 09:54:13,684 错误 [org.jboss.msc.service.fail](MSC服务线程 1-4) MSC000001: 无法启动服务 jboss.deployment.unit。“EAmvnWildfly-ear-1.0.ear”.FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit.“EAmvnWildfly- ear-1.0.ear".FIRST_MODULE_USE: WFLYSRV0153: 无法处理 org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:163) 的部署“EAmvnWildfly-ear-1.0.ear”的阶段 FIRST_MODULE_USE .jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) 在 org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 在 java.lang.Thread.run(Thread.java :745)引起:javax.persistence.PersistenceException:WFLYJPA0057:在org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.lookupProvider(PersistenceUnitServiceHandler.java:1007)中找不到PersistenceProvider'org.eclipse.persistence.jpa.PersistenceProvider' org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.nextPhaseDependsOnPersistenceUnit(PersistenceUnitServiceHandler.java:1046) 在 org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:136) 在 org.jboss.as.jpa。处理器.PersistenceBeginInstallProcessor。deploy(PersistenceBeginInstallProcessor.java:52) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:156) ... 5 更多 09:54:13,703 错误 [org.jboss.as.controller.management -operation] (DeploymentScanner-threads - 2) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit .\"EAmvnWildfly-ear-1.0.ear\".FIRST_MODULE_USE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"EAmvnWildfly-ear-1.0.ear\".FIRST_MODULE_USE: WFLYSRV0153 :无法处理部署“EAmvnWildfly-ear-1.0.ear”的阶段FIRST_MODULE_USE 原因:javax.persistence.PersistenceException:WFLYJPA0057:未找到 PersistenceProvider 'org.eclipse.persistence.jpa.PersistenceProvider'"}} 09:54:16,582 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0016:替换部署“EAmvnWildfly-ear-1.0.耳”与部署“EAmvnWildfly-ear-1.0.ear” 09:54:16,583 INFO [org.jboss.as.controller](DeploymentScanner-threads - 2)WFLYCTL0183:服务状态报告 WFLYCTL0186:未能启动的服务:服务 jboss .deployment.unit."EAmvnWildfly-ear-1.0.ear".FIRST_MODULE_USE 服务 jboss.deployment.unit."EAmvnWildfly-ear-1.0.ear".FIRST_MODULE_USE: org.jboss.msc.service.StartException 在服务 jboss.deployment 中。单元。“EAmvnWildfly-ear-1.0.ear”.FIRST_MODULE_USE:WFLYSRV0153:无法处理部署“EAmvnWildfly-ear-1.0.耳朵”

09:54:26,739 INFO [org.jboss.as.server.deployment](MSC 服务线程 1-5)WFLYSRV0208:在 91 毫秒内停止子部署(运行时名称:EAmvnWildfly-web-1.0.war) 09:54:26,749 信息[org.jboss.as.server.deployment](MSC 服务线程 1-5)WFLYSRV0028:在 112 毫秒内停止部署 EAmvnWildfly-ear-1.0.ear(运行时名称:EAmvnWildfly-ear-1.0.ear) 09:54:26,759 INFO [org.jboss.as.server.deployment](MSC 服务线程 1-7)WFLYSRV0027:开始部署“EAmvnWildfly-ear-1.0.ear”(运行时名称:“EAmvnWildfly-ear-1.0.ear”)09 :54:26,789 INFO [org.jboss.as.server.deployment](MSC 服务线程 1-7)WFLYSRV0207:开始子部署(运行时名称:“EAmvnWildfly-web-1.0.war”)09:54:27,197 INFO [ org.jboss.as.jpa](MSC 服务线程 1-7)WFLYJPA0002:读取 AdisMngmtPU 的 persistence.xml 09:54:27,236 错误 [org.jboss.msc.service.fail](MSC 服务线程 1-7)MSC000001:无法启动服务 jboss.deployment.unit。“EAmvnWildfly-ear-1.0.ear”.FIRST_MODULE_USE:org.jboss.msc服务 jboss.deployment.unit 中的 .service.StartException。“EAmvnWildfly-ear-1.0.ear”.FIRST_MODULE_USE:WFLYSRV0153:无法处理 org.jboss.as.server 上部署“EAmvnWildfly-ear-1.0.ear”的阶段 FIRST_MODULE_USE .deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:163) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl .java:1881) 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 在 java.util.concurrent。ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 原因:javax.persistence.PersistenceException: WFLYJPA0057: PersistenceProvider 'org.eclipse.persistence.jpa.PersistenceProvider'在 org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.nextPhaseDependsOnPersistenceUnit(PersistenceUnitServiceHandler.java:1046) 的 org.jboss.as 的 org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.lookupProvider(PersistenceUnitServiceHandler.java:1007) 中找不到.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:136) 在 org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:52) 在 org.jboss.as.server.deployment.DeploymentUnitPhaseService.start (DeploymentUnitPhaseService.java:156) ... 5 更多

09:54:27,279 错误 [org.jboss.as.controller.management-operation](DeploymentScanner-threads - 2)WFLYCTL0013:操作(“完全替换部署”)失败 - 地址:([]) - 失败描述: {"WFLYCTL0080: 服务失败" => {"jboss.deployment.unit.\"EAmvnWildfly-ear-1.0.ear\".FIRST_MODULE_USE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit .\"EAmvnWildfly-ear-1.0.ear\".FIRST_MODULE_USE: WFLYSRV0153: 无法处理部署阶段 FIRST_MODULE_USE \"EAmvnWildfly-ear-1.0.ear\" 原因:javax.persistence.PersistenceException: WFLYJPA0057: PersistenceProvider 'org. eclipse.persistence.jpa.PersistenceProvider' 未找到"}} 09:54:28,882 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0016:将部署“EAmvnWildfly-ear-1.0.ear”替换为部署“EAmvnWildfly-ear-1.0.ear”09:54:28,882 INFO [org.jboss.as.controller](DeploymentScanner-threads - 2)WFLYCTL0183:服务状态报告 WFLYCTL0186 :无法启动的服务:service jboss.deployment.unit."EAmvnWildfly-ear-1.0.ear".FIRST_MODULE_USE service jboss.deployment.unit."EAmvnWildfly-ear-1.0.ear".FIRST_MODULE_USE: org.jboss.msc。 service.StartException in service jboss.deployment.unit.“EAmvnWildfly-ear-1.0.ear”.FIRST_MODULE_USE:WFLYSRV0153:无法处理部署“EAmvnWildfly-ear-1.0.ear”的阶段 FIRST_MODULE_USE控制器](DeploymentScanner-threads - 2)WFLYCTL0183:服务状态报告 WFLYCTL0186:服务无法启动:服务 jboss.deployment.unit."EAmvnWildfly-ear-1.0.ear".FIRST_MODULE_USE service jboss.deployment.unit."EAmvnWildfly- ear-1.0.ear".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."EAmvnWildfly-ear-1.0.ear".FIRST_MODULE_USE: WFLYSRV0153: 无法处理部署“EAmvnWildfly-”的阶段 FIRST_MODULE_USE ear-1.0.ear"控制器](DeploymentScanner-threads - 2)WFLYCTL0183:服务状态报告 WFLYCTL0186:服务无法启动:服务 jboss.deployment.unit."EAmvnWildfly-ear-1.0.ear".FIRST_MODULE_USE service jboss.deployment.unit."EAmvnWildfly- ear-1.0.ear".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."EAmvnWildfly-ear-1.0.ear".FIRST_MODULE_USE: WFLYSRV0153: 无法处理部署“EAmvnWildfly-”的阶段 FIRST_MODULE_USE ear-1.0.ear"deployment.unit.“EAmvnWildfly-ear-1.0.ear”.FIRST_MODULE_USE:WFLYSRV0153:无法处理部署“EAmvnWildfly-ear-1.0.ear”的阶段FIRST_MODULE_USEdeployment.unit.“EAmvnWildfly-ear-1.0.ear”.FIRST_MODULE_USE:WFLYSRV0153:无法处理部署“EAmvnWildfly-ear-1.0.ear”的阶段FIRST_MODULE_USE

我的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="AdisMngmtPU" transaction-type="JTA">
     <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>java:/AdisMngmtDS</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
      <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
    </properties>
  </persistence-unit>
</persistence>
4

2 回答 2

2

尽管我使用的是 Wildfly 10,但据我所知,在 Wildfly 9 中使用 EclipseLink 的步骤是相同的​​(因此,如果它们包含版本号,您可能会调整一些文件名):

  1. 将eclipselink-2.6.1.jar 复制到文件夹中 /wildfly-10.0.0.Final/modules/system/layers/base/org/eclipse/persistence/main

  2. 在同一文件夹中编辑 module.xml 文件:

<resources>
        <resource-root path="jipijapa-eclipselink-10.0.0.Final.jar"/>
        <resource-root path="eclipselink-2.6.1.jar">
        <filter>
                <exclude path="javax/**" />
        </filter>
</resource-root>
    </resources>
  1. 如果您使用的是 MySql,则需要将 MySql-connector 放入 /wildfly-10.0.0.Final/modules/system/layers/base/com/sql/mysql/main

  2. 在您的standalone-full.xml(或standalone.xml,如果您正在使用它)中,您需要包含您的数据源和驱动程序:

    <subsystem xmlns="urn:jboss:domain:datasources:4.0">
        <datasources>
            <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
        <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                <driver>h2</driver>
                <security>
                    <user-name>sa</user-name>
                    <password>sa</password>
                </security>
            </datasource>
            <datasource jndi-name="java:/AdisMngmtDS" pool-name="AdisMngmtDS" enabled="true">
                <connection-url>jdbc:mysql://localhost/AdisMngmtDS</connection-url>
                <driver>mysql</driver>
                <security>
                    <user-name>root</user-name>
                    <password>password</password>
                </security>
                <validation>
                    <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
                    <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
                </validation>
            </datasource>               
            <drivers>
                <driver name="h2" module="com.h2database.h2">
                   <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                </driver>
                <driver name="mysql" module="com.mysql">
                    <driver-class>com.mysql.jdbc.Driver</driver-class>
                    <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                </driver>
            </drivers>
        </datasources>
    </subsystem> 
    

(你不应该删除示例数据源,因为 Wildfly 需要这个)

  1. 您可能希望包含在您的standalone-full.xml 中

    <system-properties>
        <property name="eclipselink.archive.factory" value="org.jipijapa.eclipselink.JBossArchiveFactoryImpl"/> 
    </system-properties>
    

如果你不包括这个,EclipseLink 将使用 CamelCase 作为表名等。

  1. 您的项目不应包含对 Dom4J 的任何依赖项,因为您可能会遇到 ClassCast-Exceptions。

我想就是这样。

于 2016-05-06T10:29:41.450 回答
1

我刚刚遇到了所有这些问题,让 eclipselink 2.6.3 在 Wildfly 10 上运行,它在 Windows 7、64 位平台上运行。

Joachim Rohde 所说的一切都是正确的,在https://docs.jboss.org/author/display/WFLY10/JPA+Reference+Guide#JPAReferenceGuide-UsingEclipseLink的 Wildfly 开发人员指南中也有描述。

您必须完全按照这些说明进行操作,否则会出现错误。但是,有两个例外:

  1. dom4j 依赖问题不是依赖问题或者不再是我使用的版本的问题(似乎它可以包含在 module.xml 的依赖列表中而没有错误 - 至少还没有错误)。

  2. 相反,activemq artemis 引用存在依赖关系问题(必须将依赖关系添加到 module.xml 中的依赖关系列表中)。它使用以下参考工作:

        module name="org.apache.activemq.artemis"
    

添加到依赖项列表或在您的 Wildfly 版本中的模块中查找对它的引用(如果包含)。

于 2016-07-08T15:52:06.437 回答