+

Search Tips   |   Advanced Search

 

Change the WAS configuration using the wsadmin tool

 

You can use the wsadmin AdminConfig and AdminApp objects to make changes to the WAS configuration. Before starting this task, the wsadmin tool must be running. See the Start the wsadmin scripting client article for more information. For this task, the wsadmin scripting client must be connected to the deployment manager server in a network deployment environment.

 

Overview

The purpose of this article is to illustrate the relationship between the commands that are used to change the configuration and the files that are used to hold configuration data. This discussion assumes that you have a network deployment installation, but the concepts are very similar for a WAS installation.

 

Procedure

  1. Set a variable for creating a server:

      Use Jacl:

      set n1 [$AdminConfig getid /Node:mynode/]
      

    • Use Jython:

      n1 = AdminConfig.getid('/Node:mynode/')
      

    where:

    set Jacl command
    n1 variable name
    $ Jacl operator for substituting a variable name with its value
    AdminConfig object that represents the WebSphere Application Server configuration
    getid AdminConfig command
    Node object type
    mynode name of the object to modify

  2. Create a server with the following command:

      Use Jacl:

      set serv1 [$AdminConfig create Server $n1 {{name myserv}}]
      

    • Use Jython list:

      serv1 = AdminConfig.create('Server', n1, [['name', 'myserv']])
      

    • Use Jython string:

      serv1 = AdminConfig.create('Server', n1, '[[name myserv]]')
      

    where:

    set Jacl command
    serv1 variable name
    $ Jacl operator for substituting a variable name with its value
    AdminConfig object that represents the WebSphere Application Server configuration
    create AdminConfig command
    Server AdminConfig object
    n1 evaluates to the ID of the host node that is specified in step number 1
    name attribute
    myserv value of the name attribute

    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.

  3. Make a configuration change to the server with the following command:

      Use Jacl:

      $AdminConfig modify $serv1 {{stateManagement {{initialState STOP}}}}
      

    • Use Jython list:

      AdminConfig.modify(serv1, [['stateManagement', [['initialState', 'STOP']]]])
      

    • Use Jython string:

      AdminConfig.modify(serv1, '[[stateManagement  [[initialState  STOP]]]]')
      

    where:

    $ Jacl operator for substituting a variable name with its value
    AdminConfig object that represents the WebSphere Application Server configuration
    modify AdminConfig command
    serv1 evaluates to the ID of the host node that is specified in step number 2
    stateManagement attribute
    initialState nested attribute within the stateManagement attribute
    STOP value of the initialState attribute

    This command changes the initial state of the new server. After this command completes, one of the files in the workspace is changed.

  4. Install an application on the server.

  5. Save the configuration changes. See the Saving configuration changes with the wsadmin tool article for more information.

  6. In a network deployment environment only, synchronize the node. See the Synchronizing nodes with the wsadmin tool article for more information.



Use the AdminConfig object for scripted administration

 

Related Reference


Commands for the AdminConfig object