1 Reply Latest reply on Aug 31, 2018 6:34 AM by George Labuschagne

    WildFly 14 jboss.persistenceunit throwing org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory

    George Labuschagne Newbie

      Good day

       

      I updated the POM file to reflect the dependency changes between WildFly 13 and 14 for the provided jars as per below:

       

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-core</artifactId>

                  <version>5.3.6.Final</version>

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>org.hibernate.common</groupId>

                  <artifactId>hibernate-commons-annotations</artifactId>

                  <version>5.0.4.Final</version>

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>org.hibernate.validator</groupId>

                  <artifactId>hibernate-validator</artifactId>

                  <version>6.0.13.Final</version>

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>javax.persistence</groupId>

                  <artifactId>javax.persistence-api</artifactId>

                  <version>2.2</version>

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>com.sun.mail</groupId>

                  <artifactId>javax.mail</artifactId>

                  <version>1.6.1</version>

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-search-orm</artifactId>

                  <version>5.10.3.Final</version>

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>org.jboss.spec.javax.faces</groupId>

                  <artifactId>jboss-jsf-api_2.3_spec</artifactId>

                  <version>2.3.5.SP1</version>

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>org.jboss.spec.javax.ejb</groupId>

                  <artifactId>jboss-ejb-api_3.2_spec</artifactId>

                  <version>1.0.1.Final</version>

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>com.sun.faces</groupId>

                  <artifactId>jsf-impl</artifactId>

                  <version>2.3.5.SP2</version>

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>org.jboss.spec.javax.el</groupId>

                  <artifactId>jboss-el-api_3.0_spec</artifactId>

                  <version>1.0.12.Final</version>

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>org.jboss.spec.javax.servlet</groupId>

                  <artifactId>jboss-servlet-api_4.0_spec</artifactId>

                  <version>1.0.0.Final</version>

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>javax.enterprise</groupId>

                  <artifactId>cdi-api</artifactId>

                  <version>2.0.SP1</version>

                  <scope>provided</scope>

              </dependency>

       

      Only the WildFly specific dependencies are shown.

       

      Furthermore thus was the only change to the POM file as the other dependencies were already up to date.

       

      The project compiled (it still compiles without any warnings or errors) and deployed 100% correctly on WildFly 13 with JavaEE 8 mode enabled.

       

      Now, when trying to deploy the project on WildFly 14 I get the following error below. Note that when I test the datasource in the web console it connects correctly.

       

      ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 72) MSC000001: Failed to start service jboss.persistenceunit."edsnext.war#PostgresDS": org.jboss.msc.service.StartException in service jboss.persistenceunit."edsnext.war#PostgresDS": 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.(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