我正在将一个hibernate
基于项目的项目4.2.0
从4.3.2
. 该项目被部署jboss-eap-6.4
为.ear
该项目与jboss-as-jpa
. 我在其中定义了一个persistance.xml,.ear
其中包含以下属性
<property name="hibernate.transaction.jta.platform"
value="org.hibernate.engine.transaction.jta.platform.internal.JBossAppServerJtaPlatform" />
(从 hibernate 升级到时,包的位置JBossAppServerJtaPlatform
已从 更改为。)org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform
org.hibernate.engine.transaction.jta.platform.internal.JBossAppServerJtaPlatform
4.2.0
4.3.2
如果我启动jboss
它几乎立即停止并且服务器日志中出现以下错误。
17:40:26,412 WARN [org.jboss.modules] (ServerService Thread Pool -- 27) Failed to define class org.jboss.as.jpa.hibernate4.JBossAppServerJtaPlatform in Module "org.jboss.as.jpa.hibernate:4" from local module loader @757942a1 (finder: local module finder @4a87761d (roots: C:\AlanLal\jboss-eap-6.4\modules,C:\AlanLal\jboss-eap-6.4\modules\system\layers\base)): java.lang.LinkageError: Failed to link org/jboss/as/jpa/hibernate4/JBossAppServerJtaPlatform (Module "org.jboss.as.jpa.hibernate:4" from local module loader @757942a1 (finder: local module finder @4a87761d (roots: C:\AlanLal\jboss-eap-6.4\modules,C:\AlanLal\jboss-eap-6.4\modules\system\layers\base)))
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:487) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:277) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:92) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.Module.loadModuleClass(Module.java:568) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.as.jpa.hibernate4.HibernatePersistenceProviderAdaptor.injectJtaManager(HibernatePersistenceProviderAdaptor.java:50)
at org.jboss.as.jpa.processor.PersistenceProviderAdaptorLoader.loadPersistenceAdapterModule(PersistenceProviderAdaptorLoader.java:117) [jboss-as-jpa-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at org.jboss.as.jpa.subsystem.JPAExtension.initialize(JPAExtension.java:110) [jboss-as-jpa-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at org.jboss.as.controller.extension.ExtensionAddHandler.initializeExtension(ExtensionAddHandler.java:97) [jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at org.jboss.as.controller.extension.ParallelExtensionAddHandler$ExtensionInitializeTask.call(ParallelExtensionAddHandler.java:139) [jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at org.jboss.as.controller.extension.ParallelExtensionAddHandler$ExtensionInitializeTask.call(ParallelExtensionAddHandler.java:125) [jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_172]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_172]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_172]
at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_172]
at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.2.Final-redhat-1.jar:2.1.2.Final-redhat-1]
Caused by: java.lang.NoClassDefFoundError: org/hibernate/service/jta/platform/internal/JBossAppServerJtaPlatform
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.8.0_172]
at java.lang.ClassLoader.defineClass(ClassLoader.java:763) [rt.jar:1.8.0_172]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:361) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:482) [jboss-modules.jar:1.3.6.Final-redhat-1]
... 19 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform from [Module "org.jboss.as.jpa.hibernate:4" from local module loader @757942a1 (finder: local module finder @4a87761d (roots: C:\AlanLal\jboss-eap-6.4\modules,C:\AlanLal\jboss-eap-6.4\modules\system\layers\base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.6.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.6.Final-redhat-1]
... 23 more
经过进一步的原因分析,我在 jboss 模块文件夹中发现了一个 jar jboss-as-jpa-hibernate4-7.5.0.Final-redhat-21.jar
。这个 jar 中的一个类仍然从 org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform (hibernate 4.2.) 扩展,这导致错误出现
我尝试过的事情
我试图在redhat maven repo中找到这个 jar 的更新版本,但我找不到适合 Hibernate 4.3.0 的兼容版本(即使最新版本仍然指代org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform
)
我尝试升级到但在他们的 maven repo 中hibernate 5.
找不到兼容的版本。jboss-as-jpa-hibernate4-7.5.0.Final-redhat-21.jar
是否有其他地方可以找到与此 jar 兼容的 jar hibernate 4.3.0 or even 5
,或者提到的 repo 中的任何其他包都可以用于相同的目的