title: JBoss: only one persistence provider can be packaged with an application error
body: <p>I have a web application developed on Tomcat, but I need to switch it over to JBoss 7. When I try to run my server, I get the following error:</p>
  
  <pre><code>14:55:46,728 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."reportintegration-0.0.1-SNAPSHOT.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."reportintegration-0.0.1-SNAPSHOT.war".INSTALL: Failed to process phase INSTALL of deployment "reportintegration-0.0.1-SNAPSHOT.war"
  at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
  at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
  at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [:1.8.0_131]
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [:1.8.0_131]
  at java.lang.Thread.run(Thread.java:748) [:1.8.0_131]
  Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: only one persistence provider can be packaged with an application [org.hibernate.jpa.HibernatePersistenceProvider, org.hibernate.ejb.HibernatePersistence]
  at org.jboss.as.jpa.processor.PersistenceProviderProcessor.deploy(PersistenceProviderProcessor.java:65)
  at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
  ... 5 more
  </code></pre>
  
  <p>After doing a lot of research it seems that JBoss has it's own Hibernate that it tries to use when run. I am not an expert with this stuff, so my question is do I still use my own Hibernate or theirs? For either, how would I go about that? Ideally, I could just tell JBoss to ignore theirs.</p>
  
  <p>My persistence file looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"&gt;
  &lt;persistence-unit name="DirectorDb" transaction-type="RESOURCE_LOCAL"&gt;
    &lt;description&gt;Persistence unit for Oracle Connection&lt;/description&gt; 
    &lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider&lt;/provider&gt; 
  
   &lt;properties&gt;
  
    &lt;property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver" /&gt; 
    &lt;property name="hibernate.default_schema" value=""/&gt;   
    &lt;property name="hibernate.connection.autocommit" value="true"/&gt;
    &lt;property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" /&gt; 
    &lt;property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/&gt;
    &lt;property name="hibernate.show_sql" value="false" /&gt; 
    &lt;property name="hibernate.connection.provider_class"
              value="org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider" /&gt;
    &lt;property name="hibernate.connection.isolation" value="2"/&gt;
    &lt;property name="hibernate.c3p0.max_size" value="5" /&gt;
    &lt;property name="hibernate.c3p0.min_size" value="1" /&gt;
    &lt;property name="hibernate.c3p0.acquire_increment" value="1" /&gt;
    &lt;property name="hibernate.c3p0.idle_test_period" value="150" /&gt;
    &lt;property name="hibernate.c3p0.unreturned_connection_timeout" value="300" /&gt;
    &lt;property name="hibernate.c3p0.debug_unreturned_connection_stack_traces" value="true" /&gt;
    &lt;property name="hibernate.c3p0.max_statements" value="50" /&gt;
    &lt;property name="hibernate.c3p0.max_statements_per_connection" value="20" /&gt;
    &lt;property name="hibernate.c3p0.statement_cache_num_deferred_close_threads" value="0" /&gt;
    &lt;property name="hibernate.c3p0.timeout" value="300" /&gt; 
  
   &lt;/properties&gt;
  &lt;/persistence-unit&gt;
  
  &lt;persistence-unit name="DataSourceDb" transaction-type="RESOURCE_LOCAL"&gt;
    &lt;description&gt;Persistence unit for SQL Server Connection&lt;/description&gt; 
    &lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider&lt;/provider&gt; 
  
   &lt;properties&gt;
  
    &lt;property name="javax.persistence.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" /&gt; 
    &lt;property name="hibernate.default_schema" value=""/&gt;   
    &lt;property name="hibernate.connection.autocommit" value="true"/&gt;
    &lt;property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect" /&gt; 
    &lt;property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/&gt;
    &lt;property name="hibernate.show_sql" value="false" /&gt; 
    &lt;property name="hibernate.connection.provider_class"
              value="org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider" /&gt;
    &lt;property name="hibernate.connection.isolation" value="1"/&gt;
    &lt;property name="hibernate.c3p0.max_size" value="5" /&gt;
    &lt;property name="hibernate.c3p0.min_size" value="1" /&gt;
    &lt;property name="hibernate.c3p0.acquire_increment" value="1" /&gt;
    &lt;property name="hibernate.c3p0.idle_test_period" value="150" /&gt;
    &lt;property name="hibernate.c3p0.unreturned_connection_timeout" value="300" /&gt;
    &lt;property name="hibernate.c3p0.debug_unreturned_connection_stack_traces" value="true" /&gt;  &lt;property name="hibernate.c3p0.max_statements" value="50" /&gt;
    &lt;property name="hibernate.c3p0.max_statements_per_connection" value="20" /&gt;
    &lt;property name="hibernate.c3p0.statement_cache_num_deferred_close_threads" value="0" /&gt;
    &lt;property name="hibernate.c3p0.timeout" value="300" /&gt; 
  
   &lt;/properties&gt;
  &lt;/persistence-unit&gt;
  
  &lt;/persistence&gt;
  </code></pre>
  
  <p>And my POM file:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;reportintegration&lt;/groupId&gt;
    &lt;artifactId&gt;reportintegration&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;war&lt;/packaging&gt;
    &lt;build&gt;
      &lt;sourceDirectory&gt;src&lt;/sourceDirectory&gt;
      &lt;plugins&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
          &lt;version&gt;3.6.1&lt;/version&gt;
          &lt;configuration&gt;
            &lt;source&gt;1.8&lt;/source&gt;
            &lt;target&gt;1.8&lt;/target&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
          &lt;version&gt;3.0.0&lt;/version&gt;
          &lt;configuration&gt;
            &lt;warSourceDirectory&gt;WebContent&lt;/warSourceDirectory&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
      &lt;/plugins&gt;
    &lt;/build&gt;
      &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-server&lt;/artifactId&gt;
          &lt;version&gt;2.25&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-container-servlet&lt;/artifactId&gt;
          &lt;version&gt;2.25&lt;/version&gt;
  &lt;!--    &lt;scope&gt;provided&lt;/scope&gt;   --&gt;    
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
          &lt;version&gt;2.8.6&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
          &lt;version&gt;2.8.6&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-media-moxy&lt;/artifactId&gt;
          &lt;version&gt;2.25&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
          &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;
          &lt;version&gt;1.8.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-core&lt;/artifactId&gt;
          &lt;version&gt;2.7&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-io&lt;/groupId&gt;
          &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
          &lt;version&gt;2.5&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- Servlet Context --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
          &lt;version&gt;3.1.0&lt;/version&gt;
      &lt;/dependency&gt;
          &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-jpa-2.1-api&lt;/artifactId&gt;
          &lt;version&gt;1.0.0.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
          &lt;version&gt;4.3.8.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.github.noraui&lt;/groupId&gt;
          &lt;artifactId&gt;ojdbc7&lt;/artifactId&gt;
          &lt;version&gt;12.1.0.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- Hibernate c3p0 connection pool --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-c3p0&lt;/artifactId&gt;
          &lt;version&gt;4.3.10.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.microsoft.sqlserver&lt;/groupId&gt;
          &lt;artifactId&gt;sqljdbc42&lt;/artifactId&gt;
          &lt;version&gt;6.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.oracle&lt;/groupId&gt;
          &lt;artifactId&gt;ojdbc14&lt;/artifactId&gt;
          &lt;version&gt;10.2.0.5&lt;/version&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>