0 Replies Latest reply on Oct 26, 2018 9:07 AM by Adam Bialas

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

    Adam Bialas Newbie

      down votefavorite



      I have a problem with Wildfly 11.0.0.Final. I am using JPA without direct dependencies to Hibernate (just JPA api). I have a persistence.xml file which has a definition for datasource.

      When I try to run this application I am getting the following exception when persistence.xml file is being parsed:

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

      I checked and it seems that I have one dependency which has dependency to org.dom4j with version 2.0.1. I see in wildfly modules that Hibernate module has dependency to org.dom4j:

      However, it uses dom4j module which is define in JBoss itself and there the version is 1.6.1. I understand that two different versions can cause problems.

      My questions:

      1. Is it possible to solve it by removing dependency to JBoss dom4j (1.6.1 version)? I tried already with jboss-deployment-structure but it didn't help:
      2. It works on JBoss EAP 7.1 but not on Wildfly 11.0.0.Final. What could be the reason?