我gradlew deploy
在 JBoss 7.0.5 应用程序上运行,当我尝试部署时它抱怨我的一个数据源已经存在:
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
}
我使用 JBoss cli 部署数据源 (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
并再次使用 JBoss cli 取消部署数据源 (undeploy-datasources.cli):
if (outcome == success) of ./subsystem=datasources/data-source=MarketDataSource:read-resource()
data-source remove --name=MarketDataSource --profile=@jboss.profile@
end-if
我为另一个数据源做同样的事情(除了更改名称、密码、用户名等),我对此没有任何问题。我使用了差异检查器来确保这一点。这个数据源必须配置错误,而不是另一个,但我不知道它是什么。