无法部署在 Wildfly8.1 上使用 Hibernate 3.6 的 ear

Unable to deploy ear which uses Hibernate 3.6 on Wildfly8.1

我一直在尝试在 Wildfly8.1 上部署一个使用 Hibernate 3.6 的应用程序。

我的应用程序是一个 EAR,它由 war 和 ejb.jar 组成。 在尝试了其他几件事之后,我发现这个解决方案看起来很有希望: https://developer.jboss.org/message/882769

根据这个解决方案,我已经为 hibernate 3.6 指定了正确的提供程序,并将所有需要的 jar 文件包含在 lib 目录中,但这不起作用!

我还发现这个 link 很有用:

https://docs.jboss.org/author/display/WFLY8/JPA+Reference+Guide?_sscc=t#JPAReferenceGuide-PackagingtheHibernate3.5orgreater3.xJPApersistenceproviderwithyourapplication

如有任何帮助,我们将不胜感激!!

请在下面的服务器日志中查找错误:

ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.unit."xyz.ear".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."xyz.ear".FIRST_MODULE_USE: JBAS018733: Failed to process phase FIRST_MODULE_USE of deployment "xyz.ear" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.1.0.Final.jar:8.1.0.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_71] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_71] at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71] Caused by: java.lang.LinkageError: Failed to link org/hibernate/ejb/HibernatePersistence (Module "deployment.xyz.ear:main" from Service Module Loader) at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:487) [jboss-modules.jar:1.3.3.Final] at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:277) [jboss-modules.jar:1.3.3.Final] at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:92) [jboss-modules.jar:1.3.3.Final] at org.jboss.modules.Module.loadModuleClass(Module.java:568) [jboss-modules.jar:1.3.3.Final] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) [jboss-modules.jar:1.3.3.Final] at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final] at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final] at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final] at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final] at org.jboss.as.jpa.processor.PersistenceProviderHandler.deploy(PersistenceProviderHandler.java:74) at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:49) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.1.0.Final.jar:8.1.0.Final] ... 5 more Caused by: java.lang.NoClassDefFoundError: javax/persistence/spi/PersistenceProvider at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_71] at java.lang.ClassLoader.defineClass(ClassLoader.java:800) [rt.jar:1.7.0_71] at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:361) [jboss-modules.jar:1.3.3.Final] at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:482) [jboss-modules.jar:1.3.3.Final] ... 16 more Caused by: java.lang.ClassNotFoundException: javax.persistence.spi.PersistenceProvider from [Module "deployment.xyz.ear:main" from Service Module Loader] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final] at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final] at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final] at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final] at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final] ... 20 more

15:12:01,051 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("add") failed - address: ([("subsystem" => "jsr77")]) - failure description: {"JBAS014879: One or more services were unable to start due to one or more indirect dependencies not being available." => { "Services that were unable to start:" => ["jboss.jsr77.ejb"], "Services that may be the cause:" => [ "jboss.io.worker.default", "jboss.remoting.remotingConnectorInfoService.remoting-connector", "jboss.web.common.server" ] }} 15:12:01,122 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("add") failed - address: ([("subsystem" => "remoting")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.remoting.endpoint.subsystem is missing [jboss.io.worker.default]"]} 15:12:01,135 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "xyz.ear")]) - failure description: { "JBAS014671: Failed services" => {"jboss.deployment.unit.\"xyz.ear\".FIRST_MODULE_USE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"xyz.ear\".FIRST_MODULE_USE: JBAS018733: Failed to process phase FIRST_MODULE_USE of deployment \"xyz.ear\" Caused by: java.lang.LinkageError: Failed to link org/hibernate/ejb/HibernatePersistence (Module \"deployment.xyz.ear:main\" from Service Module Loader) Caused by: java.lang.NoClassDefFoundError: javax/persistence/spi/PersistenceProvider Caused by: java.lang.ClassNotFoundException: javax.persistence.spi.PersistenceProvider from [Module \"deployment.xyz.ear:main\" from Service Module Loader]"}, "JBAS014879: One or more services were unable to start due to one or more indirect dependencies not being available." => { "Services that were unable to start:" => [ "jboss.deployment.subunit.\"xyz.ear\".\"xyz-ejb.jar\".FIRST_MODULE_USE", "jboss.deployment.subunit.\"xyz.ear\".\"xyz.war\".FIRST_MODULE_USE" ], "Services that may be the cause:" => [ "jboss.io.worker.default", "jboss.remoting.remotingConnectorInfoService.remoting-connector", "jboss.web.common.server" ] } } 15:12:01,436 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("add") failed - address: ([("subsystem" => "webservices")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.ws.config is missing [jboss.web.common.server]"]} 15:12:01,450 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("add") failed - address: ([ ("subsystem" => "naming"), ("service" => "remote-naming") ]) - failure description: {"JBAS014879: One or more services were unable to start due to one or more indirect dependencies not being available." => { "Services that were unable to start:" => ["jboss.naming.remote"], "Services that may be the cause:" => [ "jboss.io.worker.default", "jboss.remoting.remotingConnectorInfoService.remoting-connector", "jboss.web.common.server" ] }} 15:12:01,940 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("add") failed - address: ([ ("subsystem" => "ejb3"), ("service" => "remote") ]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.ejb3.connector is missing [jboss.remoting.remotingConnectorInfoService.remoting-connector]"]} 15:12:02,393 INFO [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "xyz.ear" (runtime-name : "xyz.ear") 15:12:02,570 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report JBAS014775: New missing/unsatisfied dependencies: service jboss.io.worker.default (missing) dependents: [service jboss.remoting.endpoint.subsystem] service jboss.remoting.remotingConnectorInfoService.remoting-connector (missing) dependents: [service jboss.ejb3.connector] service jboss.web.common.server (missing) dependents: [service jboss.ws.config] JBAS014777: Services which failed to start: service jboss.deployment.unit."xyz.ear".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."xyz.ear".FIRST_MODULE_USE: JBAS018733: Failed to process phase FIRST_MODULE_USE of deployment "xyz.ear"

好的,应用程序现在正在加载 wildfly 8.1。0.Final。我们最终将 Hibernate 升级到 4.1(默认情况下与 Wildfly 一起打包)。由于这是默认设置,因此不需要 'provider' 标记。我们更改了 2 个 XML 文件,即 jboss-deployment-structure.xml & persistence.xml 和应用程序中的一个 java 文件(由 ServiceLocator 组成)。