WAS and JACL scripting31 Oct 2008
Ever wondered how you could automate the processes of configuring WebSphere application server? If so I am going to give you two simple examples.
How to change some variables in WAS?
In this script we are going to change the initialHeapSize and maximumHeapSize of the JVM. Look at the script belove:
What are we doing actually, lets break down the script. Here we are just initializing some variables just like other languages.
With the AdminConfig object in WAS we are getting the configuration ID of the server.
Here we are looking up the JVM belonging to the server and storing the configuration ID.
Creating a new array with our variables we had.
With the help of AdminConfig object we are editing our found JVM with the options we have stored in our variables.
At the end we save the modified settings.
How to stop an Enterprise Application in WAS using a JACL script?
With this script we are going to stop an running application in WAS.
The first four lines initialize variables, the second line queries configuration ID of the ApplicationManager object.
The last line is actually executing the command to stop the application.
Now that we have two scripts what do we do with them?
Save the two scripts for example like, SetVars.jacl and StopApp.jacl. To use the scripts we need to make use of the /WAS_INSTALL_MAP/bin/wsadmin.sh. It is importen to keep in mind that the WAS server has to be running to be able to do this.
Execute one of the scripts:
If you want to learn more about JACL scripts and wsadmin look here.