Modifying WAR class loader mode using wsadmin scripting

You can use scripting and the wsadmin tool to modify WAR class loader mode for applications.

Before you begin

Before starting this task, the wsadmin tool must be running. See the wsadmin 스크립트를 사용하여 wsadmin 스크립트 클라이언트 시작 topic for more information.

About this task

Attention: 애플리케이션이 실행 중인 경우, 애플리케이션 설정을 변경하면 애플리케이션이 다시 시작됩니다. 독립형 서버에서 변경사항을 저장하면 애플리케이션이 다시 시작됩니다. 여러 서버 제품에서 변경사항을 저장하면 애플리케이션이 다시 시작되고 애플리케이션이 설치된 노드에서 파일이 동기화됩니다. 여러 서버 제품에서 동기화가 발생하는 시기를 제어하려면 콘솔 환경 설정 페이지에서 노드에서 변경사항 동기화를 선택 취소하십시오.

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:
    • Using 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)
    • Using Jython:
      deployments = AdminConfig.getid('/Deployment:my_application/')
    Table 1. Deployment configuration values. The following table describes the elements of the getid command.
    Element Definition
    set is a Jacl command
    deployments 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
    Deployment is an attribute
    my_application is an application in the profile_root/config/cells/cell_name/applications/ directory
  2. Set a reference to the deployedObject attribute within the deployment.xml document and set it to the deployedObject variable. For example:
    • Using Jacl:
      set deploymentObject [$AdminConfig showAttribute $deployments deployedObject]

      Example output:

      (cells/cell_name/applications/application_name.ear/deployments/
      application_name|deployment.xml#ApplicationDeployment_1276887608391)
    • Using Jython:
      deploymentObject = AdminConfig.showAttribute(deployments, 'deployedObject')
    Table 2. Deployment configuration values. The following table describes the elements in this command.
    Element Definition
    set is a Jacl command
    deploymentObject 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
    showAttribute is an AdminConfig command
    deployments is a variable to which the deployment.xml document is assigned
    deployedObject is an attribute within the deployment.xml document
  3. List the modules for the deployedObject attribute and set the list to the myModules variable. For example:
    • Using 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)
    • Using 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)']
    Table 3. Deployment configuration values. The following table describes the elements in this command.
    Element Definition
    set is a Jacl command
    myModules 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
    showAttribute is an AdminConfig command
    deployedObject is an attribute within the deployment.xml document
    modules is an attribute within the deployment.xml document
  4. Find the web module and set the mode for the class loader. For example:
    • Using Jacl:
      foreach module $myModules {
           if {[regexp WebModuleDeployment $module] == 1} {
              $AdminConfig modify $module {{classloaderMode mode}}}}
    • Using Jython
      for module in myModules:
           if (module.find('WebModuleDeployment')!= -1):
              AdminConfig.modify(module, [['classloaderMode', 'mode']])
    Table 4. Deployment configuration values. The following table describes the elements in this command.
    Element Definition
    foreach is a Jacl command
    for is a Jython command
    module is an object that is being modified
    $ is a Jacl operator for substituting a variable name with its value
    myModules is a variable name
    regexp is a function to use regular expression is used for searching within the previous commands
    module.find is a function to use regular expression is used for searching within the previous commands
    AdminConfig is an object that represents the WebSphere Application Server configuration
    modify is an AdminConfig command
    classloaderMode is an attribute within the deployment.xml document
    mode is the class loader mode value that you want to set for the WAR module. The mode value is either PARENT_FIRST or PARENT_LAST. For more information, see the documentation about class loaders.
  5. Save the configuration, for example:
    • Using Jacl:
      $AdminConfig save
    • Using Jython:
      AdminConfig.save()
  6. Verify the changes that you made to the attribute value with the showall command. For example:
    • Using Jacl:
      $AdminConfig showall $module
    • Using 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}

주제 유형을 표시하는 아이콘 태스크 주제



시간소인 아이콘 마지막 업데이트 날짜: July 9, 2016 6:15
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=txml_warclmode
파일 이름:txml_warclmode.html