title: WildFly DataSource Services which failed to start
body: <p>I configured a DataSource using WildFly to open a connection, but when I run WildFly I got this error:</p>
  
  <pre><code>11:47:46,874 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 60) MSC000001: Failed to start service jboss.persistenceunit."services.war#DataSourceBLX": org.jboss.msc.service.StartException in service jboss.persistenceunit."services.war#DataSourceBLX": 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.&lt;init&gt;(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
  
  11:47:47,776 INFO  [org.jboss.as.controller] (Controller Boot Thread)      WFLYCTL0183: Service status report
  WFLYCTL0186:   Services which failed to start:      service jboss.persistenceunit."services.war#DataSourceBLX": org.jboss.msc.service.StartException in service jboss.persistenceunit."services.war#DataSourceBLX": java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
  </code></pre>
  
  <hr>
  
  <p>Here's my persistence.xml</p>
  
  <pre><code>&lt;persistence-unit name="DataSourceBLX"&gt;
      &lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider&lt;/provider&gt;
      &lt;jta-data-source&gt;java:jboss/datasources/DataSourceBLX&lt;/jta-data-source&gt;
  
      &lt;class&gt;com.brq.blx.entity.Alteracao&lt;/class&gt;
      &lt;class&gt;com.brq.blx.entity.Anuncio&lt;/class&gt;
      &lt;class&gt;com.brq.blx.entity.Avaliacao&lt;/class&gt;
      &lt;class&gt;com.brq.blx.entity.Categoria&lt;/class&gt;
      &lt;class&gt;com.brq.blx.entity.Contato&lt;/class&gt;
      &lt;class&gt;com.brq.blx.entity.Endereco&lt;/class&gt;
      &lt;class&gt;com.brq.blx.entity.Imagem&lt;/class&gt;
      &lt;class&gt;com.brq.blx.entity.TipoUsuario&lt;/class&gt;
      &lt;class&gt;com.brq.blx.entity.Usuario&lt;/class&gt;
  
      &lt;properties&gt;
          &lt;property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" /&gt;
          &lt;property name="hibernate.show_sql" value="true" /&gt;
      &lt;/properties&gt;
  
  &lt;/persistence-unit&gt;
  </code></pre>
  
  <p>And in my standalone</p>
  
  <pre><code>&lt;datasource jndi-name="java:jboss/datasources/DataSourceBLX" pool-name="OracleXE" enabled="true"&gt;
                  &lt;connection-url&gt;jdbc:oracle:thin:@10.2.8.224:1521:fundoshomo&lt;/connection-url&gt;
                  &lt;driver&gt;oracle&lt;/driver&gt;
                  &lt;pool&gt;
                      &lt;min-pool-size&gt;1&lt;/min-pool-size&gt;
                      &lt;max-pool-size&gt;70&lt;/max-pool-size&gt;
                      &lt;prefill&gt;true&lt;/prefill&gt;
                  &lt;/pool&gt;
                  &lt;security&gt;
                      &lt;user-name&gt;stags&lt;/user-name&gt;
                      &lt;password&gt;123&lt;/password&gt;
                  &lt;/security&gt;
  &lt;/datasource&gt;
  </code></pre>
  
  <p>.</p>
  
  <pre><code>               &lt;driver name="oracle" module="com.oracle"&gt;
                      &lt;driver-class&gt;oracle.jdbc.driver.OracleDriver&lt;/driver-class&gt;
                  &lt;/driver&gt;
  </code></pre>
  
  <p>I can't see what the problem is, so if you guys could help me, 
  I would be grateful.</p>