[jboss-dev-forums] [Design of JBoss Deployment Framework] - Datasource deployer does not substitute system properties

scotto do-not-reply at jboss.com
Wed Sep 17 04:40:24 EDT 2008


We use system property substitution to assist with the configuration of our JBoss installations. This was working fine with JBoss 4.2.3.GA, however it appears to be broken in 5.0.0.CR1.

Specifically, it appears that system properties are not being substituted when deploying datasources.

For example, consider this default-ds.xml:

  | <?xml version="1.0" encoding="UTF-8"?>
  | <datasources>
  |   <local-tx-datasource>
  |     <jndi-name>DefaultDS</jndi-name>
  |     <connection-url>${vieo.datasource.url}</connection-url>
  |     <driver-class>${vieo.datasource.driver}</driver-class>
  |     <user-name>${vieo.datasource.user}</user-name>
  |     <password>${vieo.datasource.password}</password>
  |     <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
  |     <metadata>
  |         <type-mapping>PostgreSQL 8.0</type-mapping>
  |     </metadata>
  |     <!-- minimum connection pool size -->
  |     <min-pool-size>${vieo.datasource.poolsize.min}</min-pool-size>
  |     <!-- maximum connection pool size -->
  |     <max-pool-size>${vieo.datasource.poolsize.max}</max-pool-size>
  |   </local-tx-datasource>
  | </datasources>
  | 

With JBoss 4.2.3.GA we are successfully able to configure the datasource using properties supplied by the SystemPropertiesService. With JBoss 5.0.0.CR1 it appears the property substitution is not performed, and the datasource fails to deploy correctly.

To confirm this, we changed the jndi-name property line to the following:

  | <jndi-name>${vieo.datasource.name}</jndi-name>
  | 
and then added -Dvieo.datasource.name=DefaultDS to the JVM command line.

The server log confirms that the system property is not being substituted:
anonymous wrote : 
  | 2008-09-17 16:31:00,948 41048 INFO  [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] (main:) Bound Connection
  | Manager 'jboss.jca:service=DataSourceBinding,name=${vieo.datasource.name}' to JNDI name 'java:${vieo.datasource.name}'
  | 

The strange thing is that this same system property substitution DOES work for all other deployment files types (other than datasources), including mail-service.xml, jbossweb.sar/server.xml, messaging/messaging-service.xml, etc.

Is this behaviour to be expected, or is it a bug with the datasource deployer?

Thanks
Scott

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4177022#4177022

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4177022



More information about the jboss-dev-forums mailing list