org.dom4j.DocumentFactory 无法转换为 org.dom4j.DocumentFactory

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

当我尝试将部署上传到 wildlfy 10 时,我收到此错误消息:

java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory 

我尝试了很多建议的解决方案,但 none 对我有用。 tried modifying the Manifest file, ,还是一样的问题,希望有人帮我看看这个问题是怎么回事。

这是我所有文件中的原始内容

jboss-部署结构-xml:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <exclude-subsystems>
            <subsystem name="jpa" />
        </exclude-subsystems> 
        <exclusions>
            <module name="javaee.api" />
        </exclusions>
    </deployment>
</jboss-deployment-structure>

在pom.xml中:

       <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

您在部署中包含一个 dom4j 库。您需要确定它的来源并确保它被排除在外。

只是为了贡献另一个解决方案,因为我也遇到了那个例外。我使用了 wildfly(10.1.0)、hibernate(4.0.1.Final) 和 poi(3.10-FINAL)。为了正常工作,我只是将 poi 版本升级到 3.16。