Applying properties files using wsadmin scripting

Use this topic and the wsadmin tool to apply modified configuration properties to your environment using properties files.

Before you begin

Use the extractConfigProperties command in the PropertiesBasedConfiguration command group to extract the properties files of interest. Use a text editor to modify one or more values in the properties file.

Use the validateConfigProperties command in the PropertiesBasedConfiguration command group to validate the modified properties file before applying the file to your configuration.

About this task

[AIX Solaris HP-UX Linux Windows]Note: You cannot apply a z/OS® operating system properties file directly to a distributed operating system. Similarly, you cannot apply a distributed operating system properties file directly to a z/OS operating system.
You can also use interactive mode with these commands, as the following syntax demonstrates:
AdminTask.commandName('-interactive')

Procedure

  • Modify one or more properties and apply the properties file to the configuration.
    1. Start the wsadmin scripting tool.
    2. Modify the properties of interest.
      In the following properties file, use a text editor to change the value of the enableSFSB property:
      #
      # SubSection 1.0 # EJBContainer
      #
      ResourceType=EJBContainer
      ImplementingResourceType=EJBContainer
      ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}:ApplicationServer=
      ID#ApplicationServer_1:EJBContainer=ID#EJBContainer_1AttributeInfo=components
      #
      
      #
      #Properties
      #
      EJBTimer={} #ObjectName*(null)
      name=null
      defaultDatasourceJNDIName=null
      inactivePoolCleanupInterval=30000 #long
      passivationDirectory="${USER_INSTALL_ROOT}/temp"
      enableSFSBFailover=true #boolean
      server=null
      parentComponent=WebSphere Application Server Network Deployment Server
      
      EnvironmentVariablesSection
      #
      #
      #Environment Variables
      #Thu Apr 17 14:10:31 CDT 2008
      hostName2=*
      hostName1=localhost
      cellName=IBM-49F7FB781FECell07
      nodeName=IBM-49F7FB781FECellManager07
      hostName=IBM-49F7FB781FE.austin.ibm.com
      serverName=dmgr
      enableSSB=true
      
    3. Apply the modified properties to your configuration.
      Use the applyConfigProperties command to apply the properties file to the configuration, as the following Jython example demonstrates:
      AdminTask.applyConfigProperties('[-propertiesFileName ejbcontainer.props]')
  • Use additional user modified variables to modify the configuration.
    1. Start the wsadmin scripting tool.
    2. Use additional variables to modify the enableSFSBFailover property of the EJB container, changing the value from true to false.
      In the following properties file, modify the enableSFSBFailover property by specifying the value as the !{enableSSB} variable. You can use the variable in the section header or in the properties part of the section. Also, one property value can contain multiple variables as shown for ResourceId.
      #
      # SubSection 1.0 # EJBContainer
      #
      ResourceType=EJBContainer
      ImplementingResourceType=EJBContainer
      ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}:ApplicationServer=ID#ApplicationServer_1:
      EJBContainer=ID#EJBContainer_1
      AttributeInfo=components
      #
      
      #
      #Properties
      #
      EJBTimer={} #ObjectName*(null)
      name=null
      defaultDatasourceJNDIName=null
      inactivePoolCleanupInterval=30000 #long
      passivationDirectory="${USER_INSTALL_ROOT}/temp"
      enableSFSBFailover=!{enableSSB} #boolean
      server=null
      parentComponent=WebSphere Application Server Network Deployment Server
      
      EnvironmentVariablesSection
      #
      #
      #Environment Variables
      #Thu Apr 17 14:10:31 CDT 2008
      hostName2=*
      hostName1=localhost
      cellName=IBM-49F7FB781FECell07
      nodeName=IBM-49F7FB781FECellManager07
      hostName=IBM-49F7FB781FE.austin.ibm.com
      serverName=dmgr
      enableSSB=true
      
    3. Apply the modified properties to your configuration.
      Use the applyConfigProperties command to apply the properties file to the configuration, as the following Jython example demonstrates:
      AdminTask.applyConfigProperties('[-propertiesFileName ejbcontainer.props]')
  • Modify the configuration by applying a properties file and a variable map.
    1. Start the wsadmin scripting tool.
    2. Modify the enableSFSBFailover property of the EJB container, changing the value from true to false.
      Modify the enableSFSBFailover property by specifying the value as the !{enableSSB} variable in a separate variable map file. Instead of specifying the variable in the section header or in the properties part of the section, create a separate variable map file. The following code displays a sample variable map file:
      ejbprops.vars:
      #
      #
      #Environment Variables
      #Day Month 11 Time CDT Year
      hostName2=*
      hostName1=localhost
      cellName=myCell
      nodeName=myNode
      hostName=myhost.com
      serverName=myServer
      enableSSB=true
      
      The following code displays the corresponding properties file to apply to the configuration:
      #
      # SubSection 1.0 # EJBContainer
      #
      ResourceType=EJBContainer
      ImplementingResourceType=EJBContainer
      ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}:ApplicationServer=ID#ApplicationServer_1:
      EJBContainer=ID#EJBContainer_1
      AttributeInfo=components
      #
      #
      #Properties
      #
      EJBTimer={} #ObjectName*(null)
      name=null
      defaultDatasourceJNDIName=null
      inactivePoolCleanupInterval=30000 #long
      passivationDirectory="${USER_INSTALL_ROOT}/temp"
      enableSFSBFailover=true#boolean
      server=null
      parentComponent=WebSphere Application Server Network Deployment Server
    3. Apply the modified properties to your configuration.
      Use the applyConfigProperties command to apply the properties file and the variable map file to the configuration, as the following Jython example demonstrates:
      AdminTask.applyConfigProperties('[-propertiesFileName ejbcontainer.props -variablesMapFileName
       ejbprops.vars]')

What to do next

To verify that the system made the changes to your configuration, extract the properties file from your configuration using the extractPropertiesFile command.