Network Deployment (Distributed operating systems), v8.0 > Scripting the application serving environment (wsadmin) > Configure applications using scripting


Modify WAR class loader mode using wsadmin.sh

We can use scripting and wsadmin.sh to modify WAR class loader mode for applications.

If an application is running, changing an application setting causes the application to restart. On stand-alone servers, the application restarts after you save the change. On multiple-server products, the application restarts after you save the change and files synchronize on the node where the application is installed.

To control when synchronization occurs on multiple-server products, deselect Synchronize changes with nodes on the Console preferences page.

To modify WAR class loader mode for an application, complete the following steps:


Procedure

  1. Set a reference to the deployment.xml document. For example:

      ### Jacl

      set deployments [$AdminConfig getid /Deployment:my_application/]
      

      Example output:

      application_name(cells/cell_name/applications/application_name.ear/deployments/
      application_name|deployment.xml#Deployment_1276887608391)
      

      ### Jython

      deployments = AdminConfig.getid('/Deployment:my_application/')
      

  2. Set a reference to the deployedObject attribute within the deployment.xml document and set it to the deployedObject variable. For example:

      ### Jacl

      set deploymentObject [$AdminConfig showAttribute $deployments deployedObject]
      

      Example output:

      (cells/cell_name/applications/application_name.ear/deployments/
      application_name|deployment.xml#ApplicationDeployment_1276887608391)
      

      ### Jython

      deploymentObject = AdminConfig.showAttribute(deployments, 'deployedObject')
      

  3. List the modules for the deployedObject attribute and set the list to the myModules variable. For example:

      ### Jacl

      set myModules [lindex [$AdminConfig showAttribute $deploymentObject modules] 0]
      

      Example output:

      (cells/cell_name/applications/application_name.ear/deployments/
      application_name|deployment.xml#WebModuleDeployment_1276887608391)
      (cells/cell_name/applications/application_name.ear/deployments/
      application_name|deployment.xml#EJBModuleDeployment_1276887608391)
      

      ### Jython

      myModules = AdminConfig.showAttribute(deploymentObject, 'modules')
      myModules = myModules[1:len(myModules)-1].split(" ")
      print myModules
      

      Example output:

      ['(cells/cell_name/applications/application_name.ear/deployments/
      application_name|deployment.xml#WebModuleDeployment_1276887608391)',
      '(cells/cell_name/applications/application_name.ear/deployments/
      application_name|deployment.xml#EJBModuleDeployment_1276887608391)']
      

  4. Find the web module and set the mode for the class loader. For example:

      ### Jacl

      foreach module $myModules {
           if {[regexp WebModuleDeployment $module] == 1} {
              $AdminConfig modify $module {{classloaderMode mode}}}}
      

    • Use Jython
      for module in myModules:
           if (module.find('WebModuleDeployment')!= -1):
              AdminConfig.modify(module, [['classloaderMode', 'mode']])
      

  5. Save the configuration, for example:

      ### Jacl

      $AdminConfig save 

      ### Jython

      AdminConfig.save()
      

  6. Verify the changes that you made to the attribute value with the showall command. For example:

      ### Jacl

      $AdminConfig showall $module
      

      ### Jython

      AdminConfig.showall(module)
      

      Example output:

      {applicationDeployment (cells/cell_name/applications/application_name.ear/deployments/
      application_name|deployment.xml#ApplicationDeployment_1276887608391)}
      
      {classloader (cells/cell_name/applications/application_name.ear/deployments/
      application_name|deployment.xml#Classloader_1276887608392)}
      {classloaderMode mode}
      {configs {}}
      {deploymentId 1}
      {startingWeight 10000}
      {targetMappings {(cells/cell_name/applications/application_nameear/deployments/
      application_name|deployment.xml#DeploymentTargetMapping_1276887608392)}}
      {uri WAR_file_name.war}
      


Class loaders
Use the wsadmin scripting AdminConfig object for scripted administration


Related


Commands for the AdminConfig object using wsadmin.sh

+

Search Tips   |   Advanced Search