gradlewjboss-eap-7jboss-cli

Failure to deploy datasource because JBoss thinks it already exists


I am running gradlew deploy on a JBoss 7.0.5 application and it is complaining that one of my data sources already exists when I try deploying:

Deploying profile/deploy-datasources.cli
{
    "outcome" => "failed",
    "failure-description" => {"domain-failure-description" => "WFLYCTL0158: Operation handler failed: java.lang.IllegalStateException: WFLYCTL0363: Capability 'org.wildfly.data-source.MarketDataSource' is already registered in context 'profile=Int-Market'."},
    "rolled-back" => true
}

I use the JBoss cli to deploy the data source (deploy-datasources.cli):

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

and use the JBoss cli again to undeploy data sources (undeploy-datasources.cli):

if (outcome == success) of ./subsystem=datasources/data-source=MarketDataSource:read-resource()
    data-source remove --name=MarketDataSource --profile=@jboss.profile@
end-if

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.


Solution

  • Turns out there is a bug with JBoss 7.0.* explained here so I just undeployed the app and restarted my domain controller. Deploying again then worked.

    Ugrading to JBoss 7.1.* would also work but I did not have that option at the moment so that was the work around.