当前位置: 首页 > 工具软件 > Persistence4J > 使用案例 >

org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory

蒋硕
2023-12-01

问题描述:

WildFly10 发布EAR启动报错:

2019-03-22 13:17:40,318 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 58) MSC000001: Failed to start service jboss.persistenceunit."emrlibEAR.ear/emr.jar#emr": org.jboss.msc.service.StartException in service jboss.persistenceunit."emrlibEAR.ear/emr.jar#emr": 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:172)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117)
    at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:667)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    at org.jboss.threads.JBossThread.run(JBossThread.java:320)
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:342)
    at org.hibernate.internal.util.xml.XMLHelper.<init>(XMLHelper.java:26)
    at org.hibernate.envers.boot.internal.EnversServiceImpl.initialize(EnversServiceImpl.java:115)
    at org.hibernate.envers.boot.internal.AdditionalJaxbMappingProducerImpl.produceAdditionalMappings(AdditionalJaxbMappingProducerImpl.java:99)
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:288)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:847)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:874)
    at org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154)
    ... 7 more

2019-03-22 13:17:40,323 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "emrlibEAR.ear")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"emrlibEAR.ear/emr.jar#emr\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"emrlibEAR.ear/emr.jar#emr\": 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"}}

 

 

解决方案

在EAR项目META-INFO下创建jboss-deployment-structure.xml,重新启动即可。

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

来源:https://issues.jboss.org/browse/WFLY-5549

 类似资料:

相关阅读

相关文章

相关问答