Change the application server configuration
Use the wsadmin AdminConfig and AdminApp objects to make changes to the application server configuration.
The purpose of this article is to illustrate the relationship between the commands used to change the configuration and the files used to hold configuration data. This discussion assumes that we have a network deployment installation, but the concepts are very similar for an application server installation.
Tasks
- Start the wsadmin scripting tool.
For this task, connect the wsadmin scripting client to the deployment manager server in a network deployment environment.
- Set a variable for creating a server:
- Jacl:
set n1 [$AdminConfig getid /Node:mynode/]- Jython:
n1 = AdminConfig.getid('/Node:mynode/')
Element Description set is a Jacl command n1 is a variable name $ is a Jacl operator for substituting a variable name with its value AdminConfig is an object that represents the WebSphere Application Server configuration getid is an AdminConfig command Node is the object type mynode is the name of the object to modify - Create a server with the following command:
- Jacl:
set serv1 [$AdminConfig create Server $n1 {{name myserv}}]- Jython list:
serv1 = AdminConfig.create('Server', n1, [['name', 'myserv']])- Jython string:
serv1 = AdminConfig.create('Server', n1, '[[name myserv]]')
After this command completes, some new files can be seen in a workspace used by the deployment manager server on behalf of this scripting client. A workspace is a temporary repository of configuration information that administrative clients use. Any changes made to the configuration by an administrative client are first made to this temporary workspace. For scripting, when a save command is invoked on the AdminConfig object, these changes are transferred to the real configuration repository. Workspaces are kept in the wstemp subdirectory of a WAS installation.
Element Description set is a Jacl command serv1 is a variable name $ is a Jacl operator for substituting a variable name with its value AdminConfig is an object that represents the WAS configuration create is an AdminConfig command Server is an AdminConfig object n1 evaluates to the ID of the host node specified in step number 1 name is an attribute myserv is the value of the name attribute - Make a configuration change to the server with the following command:
- Jacl:
$AdminConfig modify $serv1 {{stateManagement {{initialState STOP}}}}- Jython list:
AdminConfig.modify(serv1, [['stateManagement', [['initialState', 'STOP']]]])- Jython string:
AdminConfig.modify(serv1, '[[stateManagement [[initialState STOP]]]]')
This command changes the initial state of the new server. After this command completes, one of the files in the workspace is changed.
Element Description $ Jacl operator for substituting a variable name with its value AdminConfig object that represents the WAS configuration modify n AdminConfig command serv1 Evaluate to the ID of the host node specified in step number 2 stateManagement initialState nested attribute within the stateManagement attribute STOP Value of the initialState attribute - Save the configuration changes.
AdminConfig.save()- In a network deployment environment only, synchronize the node.
Use the syncActiveNode or syncNode scripts in the AdminNodeManagement script library to propagate the configuration changes to node or nodes.
- Use the syncActiveNodes script to propagate the changes to each node in the cell:
AdminNodeManagement.syncActiveNodes()- Use the syncNode script to propagate the changes to a specific node:
AdminNodeManagement.syncNode("myNode")
Use the script library to automate the application serving environment wsadmin AdminConfig Commands for the AdminConfig object