Properties based configuration in WebSphere App Server 7

Off
Strongback Consulting

One of the new features WebSphere Application Server 7 is its properties file based configuration. Since version 5 WAS has had a scripting interface called wsadmin (it was an xml interface in prior versions), which is accessed from the WAS_HOME/bin directory as wsadmin.bat or wsadmin.sh. This scripting interface allows live interaction with the server, or you can feed it a script to run several commands at once. In prior versions of WAS, some of these scripts could be very complex if you needed to update several configurations, and subsequently could take on an application development lifecycle of its own. WAS 7 makes this much easier by referencing parameters to be changed by a simple properties file.

To demonstrate, we’ll update a JDBC property on our test WAS environment. We start by extracting the current configuration. First, start wsadmin in a new shell window.


wsadmin.bat -lang jython

wsadmin> AdminTask.extractConfigProperties('-propertiesFileName server1.props -configData Server=server1')

This will extract the entire current server properties to a text based properties file in your WAS profile bin directory. Open it up and take a look at it. I recommend using Notepad2 for readability if you are on Windows.

Notice that it is broken into sections. To get only a particular section, just substitute the resource name for the configData argument in the extractConfigProperties argument above.

In this example, I want to turn verbose garbage collection on. I simply change this value to ‘true’ and save the properties file. I’m choosing this value because turning on verbose gc makes troubleshooting JVM heap dumps easier to troubleshoot. I use this with the IBM Support Assistant (which is free) to help troubleshoot problematic environments.

Its a good idea to validate your new properties before you apply them. To do this we issue AdminTask.validateConfigProperties(‘-propertiesFileName server1.props’) at the wsadmin prompt. If valid the prompt will return ‘true’.

Next, we apply the properties with AdminTask.applyConfigProperties(‘-propertiesFileName server1.props’). If successful, the command should return two single quotes (”).
Finally save the configuration with AdminConfig.save().

To confirm that our new setting has been applied, open the administration console and go to the JVM settings for your server. These are found in under ‘Servers – Server Types – WebSphere Application Servers’ on the left navigation bar. Then go to ‘Java and Process Management’ under the ‘Server Infrastructure’ heading. On the next screen click ‘Java Virtual Machine’. Your configuration should look like the image shown.

If you have trouble with the commands you can get help by using the help interface, for example:

AdminTask.help(‘extractConfigProperties’) or AdminTask.help(‘applyConfigProperties’). If you are really lost (and just not familiar with wsadmin), call Help.help() to get started. Of course you can always call our office to get some support too.

As you can see the benefits of the new properties based configuration is easier scripting, and therefore easier automation for your environment. Its a simpler configuration and one that more easily be adapted for disparate environments.

Comments are closed.

Strongback Consulting