views:

1439

answers:

2

Configuration management for our EE application requires us to create a new database connection datasource from time to time. We do this right now by modifying the deploy/[dbtype]-ds.xml file, inserting an additional connection definition into this file. The problem is, doing so causes the existing connections to be undeployed and redeployed in addition to the new one being created.

From the JBoss log:

12:52:13,096 INFO  [ConnectionFactoryBindingService] Unbound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=dsmDS' from JNDI name 'java:dsmDS'
12:52:13,386 INFO  [ConnectionFactoryBindingService] Unbound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=ecourierDS' from JNDI name 'java:ecourierDS'
12:52:20,321 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=ecourierDS' to JNDI name 'java:ecourierDS'
12:52:20,671 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=dsmDS' to JNDI name 'java:dsmDS'
12:52:26,512 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=ecourier-core360aDS' to JNDI name 'java:ecourier-core360aDS'

Is there a way to deploy a new data source (or remove or modify an existing one) without unbinding any otherwise-unaffected data sources?

(edit) It was suggested that we just add the data source in a new file, but that doesn't work, at least not out of the box; if I add the core360aDS data source in a file named core360aDS.xml in the deploy directory, these error messages are issued:

--- Packages waiting for a deployer ---
org.jboss.deployment.DeploymentInfo@3ccd9d83 { url=file:/home/rosec/testing/ecas/var/jboss/server/core41/deploy/core360aDS.xml }
  deployer: null
  status: null
  state: INIT_WAITING_DEPLOYER
  watch: file:/home/rosec/testing/ecas/var/jboss/server/core41/deploy/core360aDS.xml
  altDD: null
  lastDeployed: 1235079499893
  lastModified: 1235079499000
  mbeans:

--- Incompletely deployed packages ---
org.jboss.deployment.DeploymentInfo@3ccd9d83 { url=file:/home/rosec/testing/ecas/var/jboss/server/core41/deploy/core360aDS.xml }
  deployer: null
  status: null
  state: INIT_WAITING_DEPLOYER
  watch: file:/home/rosec/testing/ecas/var/jboss/server/core41/deploy/core360aDS.xml
  altDD: null
  lastDeployed: 1235079499893
  lastModified: 1235079499000
  mbeans:
+2  A: 

You can store the datasources each in their own file. This way you can avoid undeploying the other datasources in the file you are modifying. You can simply name the datasource xml file after the datasource name thus making it easy to find and edit the necessary file.

Mr. Shiny and New
+1  A: 

As Mr. Shiny and New mentions, above, the right way is to place the data sources in their own files. The trick is that the file names have to conform to the suffix supported in the jbossjca-service.xml deployer file.

So, create a new file per-datasource, with the name foo-ds.xml.

Chris R