简体   繁体   English

使用JBoss 4.2.x,如何在不取消部署现有数据源的情况下部署新数据源?

[英]Using JBoss 4.2.x, how can I deploy a new data source without undeploying existing ones?

Configuration management for our EE application requires us to create a new database connection datasource from time to time. 我们的EE应用程序的配置管理要求我们不时创建新的数据库连接数据源。 We do this right now by modifying the deploy/[dbtype]-ds.xml file, inserting an additional connection definition into this file. 我们现在通过修改deploy / [dbtype] -ds.xml文件,在此文件中插入其他连接定义来实现此目的。 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: 从JBoss日志:

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: 如果我将core360aDS数据源添加到部署目录中名为core360aDS.xml的文件中,则会发出以下错误消息:

--- 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:

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. 您只需在数据源名称后面命名datasource xml文件,即可轻松查找和编辑必要的文件。

As Mr. Shiny and New mentions, above, the right way is to place the data sources in their own files. 正如Shiny和New先生提到的,正确的方法是将数据源放在他们自己的文件中。 The trick is that the file names have to conform to the suffix supported in the jbossjca-service.xml deployer file. 诀窍是文件名必须符合jbossjca-service.xml deployer文件中支持的后缀。

So, create a new file per-datasource, with the name foo -ds.xml . 因此,创建一个新的文件per-datasource,名称为foo -ds.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM