gpt4 book ai didi

java - WildFly 14 - java.lang.ClassCastException : org. dom4j.DocumentFactory 无法转换为 org.dom4j.DocumentFactory

转载 作者:行者123 更新时间:2023-11-30 02:00:50 26 4
gpt4 key购买 nike

我有一个应用程序可以在WildFly 8.2.1.Final版本上完美运行,没有问题。但我想将服务器版本从 8.2.1.Final 升级到 14.0.1.Final,并将数据源添加到 14.0.1.Final 后,我正在启动应用程序并收到以下错误。

  • 我尝试将提供的范围添加到 hibernate-core 依赖项中,但没有解决。
  • 我尝试添加 dom4j 作为 Maven 依赖项,但没有解决。
  • 我从 WildFly 模块中删除了 dom4j.jar 并添加为 Maven 依赖项,但这次遇到了模块加载问题。

这个问题的解决方案是什么?

13:32:25,121 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 17) MSC000001: Failed to start service jboss.persistenceunit."warName.war#persistenceUnitName": org.jboss.msc.service.StartException in service jboss.persistenceunit."warName.war#persistenceUnitName": java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:195)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:125)
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:650)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:209)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:485)
Caused by: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
at org.dom4j.DocumentFactory.getInstance(DocumentFactory.java:97)
at org.hibernate.internal.util.xml.XMLHelper$1.doWork(XMLHelper.java:33)
at org.hibernate.internal.util.xml.XMLHelper$1.doWork(XMLHelper.java:27)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.workWithClassLoader(ClassLoaderServiceImpl.java:483)
at org.hibernate.internal.util.xml.XMLHelper.<init>(XMLHelper.java:26)
at org.hibernate.envers.boot.internal.EnversServiceImpl.initialize(EnversServiceImpl.java:116)
at org.hibernate.envers.boot.internal.AdditionalJaxbMappingProducerImpl.produceAdditionalMappings(AdditionalJaxbMappingProducerImpl.java:101)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:297)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:904)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:935)
at org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:167)
... 9 more

13:32:25,133 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "warName.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"warName.war#persistenceUnitName\"" => "java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
Caused by: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory"}}
13:32:25,135 ERROR [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0021: Deploy of deployment "warName.war" was rolled back with the following failure message:
{"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"warName.war#persistenceUnitName\"" => "java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
Caused by: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory"}}
13:32:25,155 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 17) WFLYJPA0011: Stopping Persistence Unit (phase 1 of 2) Service 'warName.war#persistenceUnitName'
13:32:25,376 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0028: Stopped deployment authentication.war (runtime-name: warName.war) in 241ms
[2018-10-20 01:32:25,481] Artifact module:war: Error during artifact deployment. See server log for details.
[2018-10-20 01:32:25,482] Artifact module:war: java.lang.Exception: {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"warName.war#persistenceUnitName\"" => "java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
Caused by: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory"}}

最佳答案

https://issues.jboss.org/browse/WFLY-5549 找到了可能的解决方案

基本上添加一个 jboss-deployment-struct.xml,它添加了对模块 org.dom4j 的依赖

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.dom4j"/>
</dependencies>
</deployment>
</jboss-deployment-structure>

还要检查 war 中的 lib 文件夹。删除所有与 hibernate 相关的 jar。还有dom4jWildfly 已经提供了它们。在hibernate模块modules/system/layers/base/org/hibernate/main/module.xml中设置了对org.dom4j的依赖。

关于java - WildFly 14 - java.lang.ClassCastException : org. dom4j.DocumentFactory 无法转换为 org.dom4j.DocumentFactory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52904838/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com