Wildfly 9 上的部署失败

Posted

技术标签:

【中文标题】Wildfly 9 上的部署失败【英文标题】:Deployment failed on Wildfly 9 【发布时间】:2015-08-05 22:21:38 【问题描述】:

我曾经在 Wildfly 8 上遇到过这个问题,但已解决,包括 $WILDFLY_HOME/modules/system/layers/base/org/eclipse/persistence/main 中的 eclipselink.jar 并使用资源根目录更新 module.xml

<resource-root path="eclipselink.jar" />

并包含在我的 ejb 模块的 POM.xml 中

    <dependency>  
        <groupId>org.eclipse.persistence</groupId>  
        <artifactId>eclipselink</artifactId>  
        <version>2.6.0</version>  
        <scope>provided</scope>  
    </dependency>  

这在 Wildfly 8.* 中运行良好。不幸的是,为 Wildfly 9CR1 使用相同的技术始终未能通过以下日志:

08:52:31,028 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.unit."rga-ear-1.0.ear".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."rga-ear-1.0.ear".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment "rga-ear-1.0.ear"
    at org.jboss.as.server.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)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.ServiceConfigurationError: javax.persistence.spi.PersistenceProvider: Provider org.eclipse.persistence.jpa.PersistenceProvider could not be instantiated
    at java.util.ServiceLoader.fail(ServiceLoader.java:232)
    at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
    at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
    at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
    at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
    at org.jboss.as.jpa.persistenceprovider.PersistenceProviderLoader.loadProviderModuleByName(PersistenceProviderLoader.java:70)
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.lookupProvider(PersistenceUnitServiceHandler.java:998)
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.nextPhaseDependsOnPersistenceUnit(PersistenceUnitServiceHandler.java:1046)
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:136)
    at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:52)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:156)
    ... 5 more
Caused by: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.eclipse.persistence.jpa.PersistenceProvider.getProviderUtil()Ljavax/persistence/spi/ProviderUtil;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/eclipse/persistence/jpa/PersistenceProvider, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for interface javax/persistence/spi/PersistenceProvider have different Class objects for the type javax/persistence/spi/ProviderUtil used in the signature
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2658)
    at java.lang.Class.getConstructor0(Class.java:2964)
    at java.lang.Class.newInstance(Class.java:403)
    at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
    ... 13 more

08:52:31,195 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "rga-ear-1.0.ear")]) - failure description: "WFLYCTL0080: Failed services" => "jboss.deployment.unit.\"rga-ear-1.0.ear\".FIRST_MODULE_USE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"rga-ear-1.0.ear\".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment \"rga-ear-1.0.ear\"
    Caused by: java.util.ServiceConfigurationError: javax.persistence.spi.PersistenceProvider: Provider org.eclipse.persistence.jpa.PersistenceProvider could not be instantiated
    Caused by: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method \"org.eclipse.persistence.jpa.PersistenceProvider.getProviderUtil()Ljavax/persistence/spi/ProviderUtil;\" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/eclipse/persistence/jpa/PersistenceProvider, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for interface javax/persistence/spi/PersistenceProvider have different Class objects for the type javax/persistence/spi/ProviderUtil used in the signature"

我也试过删除

<resource-root path="eclipselink.jar" />
eclipselink.jar

但是得到一个不同的错误 Persistence Provider Not Found。 这可能是 Wildfly 错误还是我做的不对?

【问题讨论】:

看起来您正在加载两个不同的 javax.persistence.spi.PersistenceProvider 类。 eclipse 链接是否将其打包到它的存档中? 不,eclipselink.jar 没有 javax.persistence.spi.PersistenceProvider 它可能包含在您的 EAR 中吗?您的课程路径中肯定有两个副本。 我说不上来,但有趣的是相同的 app.ear 已成功部署在 Wildfly 8.2 上,并且在standalone.xml 上具有类似的设置。 【参考方案1】:

有同样的问题,并使用 wf9 文档解决: wildlfy 9 eclipselink

基本上是&lt;resource-root path="eclipselink.jar" /&gt;

放置这个

<resource-root path="eclipselink.jar">
        <filter>
                <exclude path="javax/**" />
        </filter>
        </resource-root>

顺便说一下,我用的是eclipslink 2.5.2

【讨论】:

以上是关于Wildfly 9 上的部署失败的主要内容,如果未能解决你的问题,请参考以下文章

在Wildfly上的Startup bean中通过JMX进行AttributeNotFoundException

在 Wildfly 上部署 KIE-CI 失败

如何让 JBoss/WildFly 在应用程序部署/初始化失败时自动终止?

Wildfly上的Servlet部署-找不到页面

带有 PostgreSQL 9.4 数据源的 WildFly 10 部署应用程序时出错

如何将 root(/) 上下文中的 war 文件部署到 Wildfly 9.0.1 版