Artwork implying World Wide Web Architecture

Display WebSphere Application Server Variables

Part of the WebSphere Application Server v6.x Administration Series Series
Most recently modified on 2008-07-24
Back to home pageBack to articles page

WebSphere Application Server makes heavy use of variables in its configuration files. This is to make it easier to change your configuration. For example, if every reference to every file were a fully qualified, absolute reference, it would be difficult to administer WebSphere Application Server. There would be times when moving a file from one directory tree to another would require hundreds of configuration edits. WAS vairables represent any of the following

File LocationMeaning
WAS_INSTALL_ROOTThe location of WebSphere Application Server binary files
USER_INSTALL_ROOTAllows you to write scripts that can serve any user
LOG_ROOTThe location of various logs
APP_INSTALL_ROOTThe location of exploded EAR files
DERBY_JDBC_DRIVER_PATHEnable you to write scripts that do not have to be changed if you ever move this driver to a different place in your file system
Useful NameMeaning
WAS_SERVER_NAMEEnables you to write a script that you can run against any server without knowing the server's name in advance
WAS_CELL_NAMEEnables you to write a script that you can run against any cell without knowing the server's name in advance

What would a script possibly do with any WebSphere Variable?

  1. Read an existing WebSphere Variable
  2. Change the value of an existing WebSphere Variable
  3. Create a new WebSphere Variable

What do you have to think about when you use any WebSphere Variable in a script?

  1. What is the name of the variable?
  2. What is the scope of the variable? Your choices are cell scope, node scope or server scope
  3. Do you want to change the value of the variable or just read the value of the variable?

To see WebSphere variables and their values:

  • AdminTask.showVariables( "[ -scope " + someScope + " ]" )
  • AdminTask.showVariables( "[ -scope " + someScope + " -variableName " + someVariableName +" ]" )
  • someScope is case sensitive. someScope is supplied by the programmer and takes the form of
    • "Cell=something" -- cell scope
    • "Node=something" -- node scope
    • "Node=something,Server=something" -- server scope

The AdminTask.showVariables() method examines the content of the variables.xml configuration file associated with the chosen scope. If there is no such file in the scope you choose, AdminTask.showVariables() throws an exception.

getVariablesInScope() contains code that finds all the variables in either

  • Cell scope
  • A given Node scope
  • A given Server scope

The code that actually searches for the variables is the call to AdminTask.showVariables() near lines 21 and 26. Everything else converts the string that AdminTask.showVariables() returns into a Python Dictionary of variables and their values. The try block around these two lines traps the exception that AdminTask.showVariables() throws when there are no variables in the scope you request

Photo of the author

Arthur Kevin McGrath

Bio:

The author is an engineer with the consulting firm, Contract Engineers. He has consulted and lectured extensively since 1987 about the infrastructure that makes electronic commerce possible

To schedule a speaker at your location, write speakers@edu4eng.com
To inquire about consulting for your company, write consultants@edu4eng.com
To inquire about training for your company, write training@edu4eng.com