title: Jboss 7 - Oracle Datasource not working
body: <p>I'm working on a Web App with just one WAR project. It uses JPA and has a DataSource that I need to configure to run on <strong>JBOSS 7</strong>. The database is <strong>Oracle</strong>.</p>
  
  <p>I'm getting this error:</p>
  
  <pre><code>JBAS014775:    New missing/unsatisfied dependencies:
        service jboss.naming.context.java.jboss.resources.jboss.jdbc.batchAdminDB
  </code></pre>
  
  <p>I've followed instructions for using dataSource on Jboss. So I have these configurations:</p>
  
  <p><strong>{JBOSS_HOME}/modules/com/oracle/ojdbc6/main/module.xml:</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;module xmlns="urn:jboss:module:1.1" name="com.oracle.ojdbc6"&gt;
      &lt;resources&gt;
          &lt;resource-root path="ojdbc6.jar"/&gt;
      &lt;/resources&gt;
      &lt;dependencies&gt;
          &lt;module name="javax.api" /&gt;
          &lt;module name="javax.transaction.api"/&gt;
          &lt;module name="javax.servlet.api" optional="true"/&gt;
      &lt;/dependencies&gt;
  &lt;/module&gt;
  </code></pre>
  
  <p>ojdbc6.jar exists and the name is correct.</p>
  
  <p><strong>standalone.xml</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;datasources&gt;
  
                  &lt;datasource jndi-name="java:jboss/jdbc/batchAdminDB" pool-name="batchAdminDB" enabled="true" use-java-context="true"&gt;
                      &lt;connection-url&gt;jdbc:oracle:thin:@HOST:PORT/xe&lt;/connection-url&gt;
                      &lt;driver&gt;oracle&lt;/driver&gt;
                      &lt;security&gt;
                          &lt;user-name&gt;USER&lt;/user-name&gt;
                          &lt;password&gt;PASSW&lt;/password&gt;
                      &lt;/security&gt;
                  &lt;/datasource&gt;
                  &lt;drivers&gt;
                      &lt;driver name="oracle" module="com.oracle.ojdbc6"&gt;
                          &lt;driver-class&gt;oracle.jdbc.driver.OracleDriver&lt;/driver-class&gt;
                          &lt;xa-datasource-class&gt;oracle.jdbc.xa.client.OracleXADataSource&lt;/xa-datasource-class&gt;
                      &lt;/driver&gt;
                  &lt;/drivers&gt;
              &lt;/datasources&gt;
  </code></pre>
  
  <p>On the application:
  META-INF/<strong>persistence.xml:</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;persistence-unit name="batchAdminEM" transaction-type="JTA"&gt;
      &lt;jta-data-source&gt;java:jboss/jdbc/batchAdminDB&lt;/jta-data-source&gt;
  
      &lt;class&gt;...&lt;/class&gt;
   ...&lt;/persistence-unit&gt;
  </code></pre>
  
  <p>When Jboss starts (without the app) it get to read(bound) the datasource. The error comes when I try to deploy the app, it doesn't run.</p>
  
  <p>More of StackTrace to help:</p>
  
  <pre><code>15:57:46,888 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:jboss/jdbc/batchAdminDB]
  ...
  15:57:52,356 INFO  [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-2) HHH000204: Processing PersistenceUnitInfo [
      name: batchAdminEM
      ...]
  15:57:53,649 ERROR [org.jboss.as] (MSC service thread 1-1) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 13255ms - Started 325 of 568 services (165 services failed or missing dependencies, 76 services are passive or on-demand)
  15:57:53,861 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "BatchAdmin.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" =&gt; ["jboss.naming.context.java.module.BatchAdmin.BatchAdmin.env.jboss.jdbc.batchAdminDBjboss.naming.context.java.jboss.resources.jboss.jdbc.batchAdminDBMissing[jboss.naming.context.java.module.BatchAdmin.BatchAdmin.env.jboss.jdbc.batchAdminDBjboss.naming.context.java.jboss.resources.jboss.jdbc.batchAdminDB]"]}
  JBAS014775:    New missing/unsatisfied dependencies:
        service jboss.naming.context.java.jboss.resources.jboss.jdbc.batchAdminDB (missing) dependents: [service jboss.naming.context.java.module.BatchAdmin.BatchAdmin.env.jboss.jdbc.batchAdminDB] 
  
  15:57:53,934 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" =&gt; {"Operation step-2" =&gt; {"JBAS014771: Services with missing/unavailable dependencies" =&gt; ["jboss.naming.context.java.module.BatchAdmin.BatchAdmin.env.jboss.jdbc.batchAdminDBjboss.naming.context.java.jboss.resources.jboss.jdbc.batchAdminDBMissing[jboss.naming.context.java.module.BatchAdmin.BatchAdmin.env.jboss.jdbc.batchAdminDBjboss.naming.context.java.jboss.resources.jboss.jdbc.batchAdminDB]"]}}}
  </code></pre>