title: Failure to deploy datasource because JBoss thinks it already exists
body: <p>I am running <code>gradlew deploy</code> on a JBoss 7.0.5 application and it is complaining that one of my data sources already exists when I try deploying:</p>
  
  <pre><code>Deploying profile/deploy-datasources.cli
  {
      "outcome" =&gt; "failed",
      "failure-description" =&gt; {"domain-failure-description" =&gt; "WFLYCTL0158: Operation handler failed: java.lang.IllegalStateException: WFLYCTL0363: Capability 'org.wildfly.data-source.MarketDataSource' is already registered in context 'profile=Int-Market'."},
      "rolled-back" =&gt; true
  }
  </code></pre>
  
  <p>I use the JBoss cli to deploy the data source (deploy-datasources.cli):</p>
  
  <pre><code>if (outcome == success) of ./subsystem=datasources/data-source=MarketDataSource:read-resource()
      data-source remove --name=MarketDataSource --profile=@jboss.profile@
  end-if
  ./subsystem=datasources/data-source=MarketDataSource:add( \
      jta=false, \
      jndi-name="java:/MarketDataSource", \
      driver-name="oracle", \
      connection-url="@leftthisout@", \
      user-name="@leftthisout@", \
      password="$\{@leftthisout@\}", \
      min-pool-size=1, \
      max-pool-size=5, \
      validate-on-match=true, \
      valid-connection-checker-class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker", \
      stale-connection-checker-class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker", \
      exception-sorter-class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter", \
      idle-timeout-minutes=10, \
      prepared-statements-cache-size=120, \
      enabled=true \
  )
  
  if (outcome == success) of ./subsystem=datasources/data-source=MarketDataSource:read-resource
    ./subsystem=datasources/data-source=MarketDataSource/connection-properties=defaultRowPrefetch:add(value=100)
  end-if
  </code></pre>
  
  <p>and use the JBoss cli again to undeploy data sources (undeploy-datasources.cli):</p>
  
  <pre><code>if (outcome == success) of ./subsystem=datasources/data-source=MarketDataSource:read-resource()
      data-source remove --name=MarketDataSource --profile=@jboss.profile@
  end-if
  </code></pre>
  
  <p>I do the same thing (except changing name, passwords, usernames etc.) for another data source and I have no issues with that. I have used a difference checker to ensure that. Something must be configured wrong with this datasource as opposed to the other but I can't figure out what it is.</p>