Friday, July 2, 2010

How to set System properties in JBoss

Target Audience: Beginners
Most of the times, we have to deploy our application in many environments for testing before going to production or live. We might have configuration values which need to be set in System Properties and these configuration might change based on the environment. We set System propertis in run.conf , or run.bat files with -D prefix
E.g: If we want to Set System property with key ‘myKey’ and with value ‘myValue” then we do something like JAVA_OPTS="XXXXXX -DmyKey=myValue.

JBoss give a rich way to load system properties. System properties can also be provided using the System Properties Service. This service allows you to specify one or more system propertis as key value pair or through loading one or more properties file. The Service configuration file can be found in the server/xxx/deploy/properties-service.xml.

The following section describes hoe to set one or more system properties as Key Value pairs.

<mbean code=""
<attribute name="Properties">

The Properties attribute section configures properties directly in the service
configuration. Properties must be specified as a name/value pair on a separate

The following section describes hoe to set system properties through loading one or more files.

<mbean code=""
<attribute name="URLList">
http://localhost/, ./conf/

The URLList attribute section refers to properties files that contain system properties.
You can provide a URL(http://localhost/ or a directory which is relative(./conf/ to the root of the server configuration.
Multiple entries should be separated with commas as shown above.

Hope this tutorial helps you.

No comments:

Post a Comment