IBM Support

Defining variables in cluster-scope with wsadmin

Troubleshooting


Problem

You cannot define IBM WebSphere Application Server variables for a cluster using wsadmin. Defining variables for a server using wsadmin can be done easily with the following commands: #getting the varMap wsadmin>set varMap [$AdminConfig getid /Node:/Server:/VariableMap:/] (cells//nodes//servers/:variables.xml# VariableMap_1) #setting a mapping and creating it in this varMap wsadmin>set attrs [list [list symbolicName Test] [list value 10]] wsadmin>$AdminConfig create VariableSubstitutionEntry $varMap $attrs

Symptom

For a cluster:

wsadmin>set a [$AdminConfig getid /ServerCluster:/]
arztest(cells/tcwas601/clusters/arztest|cluster.xml#ServerCluster1118831111774)

wsadmin>set b [$AdminConfig list VariableMap $a]


The second command returns nothing. A reference to the VariableMap object is not found.

Cause

When a cluster is created, no variables.xml file is created in the /config/cells/<cell_name>/clusters/<cluster_name>/ directory. Therefore, commands referencing this object, VariableMap, will not work.

Resolving The Problem

You must first create varaibles.xml file in the following directory:

/config/cells/<cell_name>/clusters/<cluster_name>/

To do so, use the $AdminConfig createDocument command, as follows:

wsadmin>$AdminConfig createDocument cells/<cell_name>/clusters/<cluster_name>/variables.xml  "C:\\<was_home>\\profiles\\Dmgr01\\config\\templates\\servertypes\\APPLICATION_SERVER\\servers\\default\\variables.xml"    

Now that a variables.xml has been created, reference it using the 2 commands as before:

wsadmin>set a [$AdminConfig getid /ServerCluster:/]   cluster1(cells/ibmCell01/clusters/cluster1|cluster.xml#ServerCluster_110778999)                                                
wsadmin>set b [$AdminConfig list VariableMap $a] (cells/ibmCell01/clusters/cluster1|variables.xml#VariableMap1118754715594)        
Then use the VariableSubstitutionEntry command to define your variables:
wsadmin>set attrs [list [list symbolicName Test] [list value 10]]    
wsadmin>$AdminConfig create VariableSubstitutionEntry $b $attrs

[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Administrative Scripting Tools (for example: wsadmin or ANT)","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF012","label":"IBM i"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"7.0;6.1","Edition":"Base;Express;Network Deployment","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSNVBF","label":"Runtimes for Java Technology"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Java SDK","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
15 June 2018

UID

swg21211031