Issue deploying two applications that need to connect to different databases in JBoss EAP 5
Issue
- We are having problems while trying to connect two applications from JBoss.
At the moment there is a display of an application named my time (app1.war) which connects to the database using the following connection string defined in app1-ds.xml:
$JBOSS_HOME/server/$PROFILE/deploy/app1-ds.xml
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/MyDB</jndi-name>
<connection-url>jdbc:sqlserver://databaseHost:1433;databaseName=App1</connection-url>
...
</local-tx-datasource>
</datasources>
We now have another application app2.war that we need to deploy on the same JBoss instance, which should connect to the database with the following connection string:
$JBOSS_HOME/server/$PROFILE/deploy/app2-ds.xml
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/MyDB</jndi-name>
<connection-url>jdbc:sqlserver://databaseHost:1433;databaseName=App2</connection-url>
...
</local-tx-datasource>
</datasources>
The issue is app2 cannot connect to its database.
- We are seeing this issue in the log, we have two *-ds.xml specifying the same
jndi-name:
...
Caused by: java.lang.IllegalStateException: jboss.jca:name=jdbc/MyDB,service=ManagedConnectionFactory is already installed.
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:719)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:543)
at org.jboss.system.ServiceController.doInstall(ServiceController.java:670)
at org.jboss.system.ServiceController.install(ServiceController.java:273)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:90)
... 37 more
Environment
Red Hat JBoss Enterprise Application Platform (EAP)
- 5.2.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
