Configuring a shared library for an application using wsadmin scripting

This task uses the AdminConfig object to configure a shared library for an application. Shared libraries are files used by multiple applications. Create a shared library to reduce the number of duplicate library files on your system.

Before you begin

There are two ways to complete this task. The example in this topic uses the AdminConfig object to create and configure a shared library. Alternatively, you can use the createSharedLibrary script in the AdminResources script library to configure shared libraries.

스크립트 라이브러리는 가장 일반적인 관리 기능을 자동화하는 프로시저 세트를 제공합니다. 각 스크립트 프로시저를 개별적으로 실행하거나 여러 프로시저를 결합하여 새 스크립트를 신속하게 개발할 수 있습니다.

Procedure

  1. wsadmin 스크립트 도구를 시작하십시오.
  2. Identify the shared library and assign it to the library variable. You can either use an existing shared library or create a new one, for example:
    • To create a new shared library, perform the following steps:
      1. Identify the node and assign it to a variable, for example:
        • Using Jacl:
          set n1 [$AdminConfig getid /Cell:mycell/Node:mynode/]
        • Using Jython:
          n1 = AdminConfig.getid('/Cell:mycell/Node:mynode/')
          
          print n1
        Table 1. getid command elements. Run the getid command to identify a shared library.
        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 representing the WebSphere® Application Server configuration
        getid is an AdminConfig command
        Cell is the object type
        mycell is the name of the object that will be modified
        Node is the object type
        mynode is the name of the object that will be modified
        Example output:
        mynode(cells/mycell/nodes/mynode|node.xml#Node_1)
      2. Create the shared library in the node. The following example creates a new shared library in the node scope. You can modify it to use the cell or server scope.
        • Using Jacl:

          [AIX Solaris HP-UX Linux Windows]
          set library [$AdminConfig create Library $n1 {{name mySharedLibrary} 
          {classPath c:/mySharedLibraryClasspath}}]
          [z/OS]
          set library [$AdminConfig create Library $n1 {{name mySharedLibrary} 
          {classPath /mySharedLibraryClasspath}}]
        • Using Jython:

          [AIX Solaris HP-UX Linux Windows]
          library = AdminConfig.create('Library', n1, [['name', 'mySharedLibrary'], 
          ['classPath', 'c:/mySharedLibraryClasspath']])
          
          print library
          [z/OS]
          library = AdminConfig.create('Library', n1, [['name', 'mySharedLibrary'], 
          ['classPath', '/mySharedLibraryClasspath']])
          
          print library
        Table 2. create Library command elements. Run the create command to create a shared library.
        Element Description
        set is a Jacl command
        library is a variable name
        $ is a Jacl operator for substituting a variable name with its value
        AdminConfig is an object representing the WebSphere Application Server configuration
        create is an AdminConfig command
        Library is an AdminConfig object
        n1 evaluates to the ID of host node specified in step number 1
        name is an attribute
        mySharedLibrary is the value of the name attribute
        classPath is an attribute
        /mySharedLibraryClasspath is the value of the classPath attribute
        Example output:
        MySharedLibrary(cells/mycell/nodes/mynode|libraries.xml#Library_1)
    • To use an existing shared library, issue the following command:
      • Using Jacl:
        set library [$AdminConfig getid /Library:mySharedLibrary/]
      • Using Jython:
        library = AdminConfig.getid('/Library:mySharedLibrary/')
        print library
      Table 3. getid Library command elements. Run the getid command to identify a shared library.
      Element Description
      set is a Jacl command
      library is a variable name
      $ is a Jacl operator for substituting a variable name with its value
      AdminConfig is an object representing the WebSphere Application Server configuration
      getid is an AdminConfig command
      Library is an attribute
      mySharedLibrary is the value of the Library attribute
      Example output:
      MySharedLibrary(cells/mycell/nodes/mynode|libraries.xml#Library_1)
  3. Identify the deployment configuration object for the application and assign it to the deployment variable. For example:
    • Using Jacl:
      set deployment [$AdminConfig getid /Deployment:myApp/]
    • Using Jython:
      deployment = AdminConfig.getid('/Deployment:myApp/')
      
      print deployment
    Table 4. getid Deployment command elements. Run the getid command to identify a deployment object.
    Element Description
    set is a Jacl command
    deployment is a variable name
    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object representing the WebSphere Application Server configuration
    getid is an AdminConfig command
    Deployment is an attribute
    myApp is the value of the Deployment attribute
    print is a Jython command
    Example output:
    myApp(cells/mycell/applications/myApp.ear/deployments/myApp|deployment.xml#Deployment_1)
  4. Retrieve the application deployment and assign it to the appDeploy variable. For example:
    • Using Jacl:
      set appDeploy [$AdminConfig showAttribute $deployment deployedObject]
    • Using Jython:
      appDeploy = AdminConfig.showAttribute(deployment, 'deployedObject')
      
      print appDeploy
    Table 5. showAttribute deployment command elements. Run the showAttribute command to assign a deployed object.
    Element Description
    set is a Jacl command
    appDeploy is a variable name
    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object representing the WebSphere Application Server configuration
    showAttribute is an AdminConfig command
    deployment evaluates the ID of the deployment configuration object specified in step number 2
    deployedObject is an attribute of modify objects
    print is a Jython command
    Example output:
    (cells/mycell/applications/myApp.ear/deployments/myApp|deployment.xml#ApplicationDeployment_1)
  5. Identify the class loader in the application deployment and assign it to the classLoader variable. For example:
    • Using Jacl:
      set classLoad1 [$AdminConfig showAttribute $appDeploy classloader]
    • Using Jython:
      classLoad1 = AdminConfig.showAttribute(appDeploy, 'classloader')
      
      print classLoad1
    Table 6. showAttribute appDeploy command elements. Run the showAttribute command to assign a class loader.
    Element Description
    set is a Jacl command
    classLoad1 is a variable name
    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object representing the WebSphere Application Server configuration
    showAttribute is an AdminConfig command
    appDeploy evaluates the ID of the application deployment specified in step number 3
    classLoader is an attribute of modify objects
    print is a Jython command
    Example output:
    (cells/mycell/applications/myApp.ear/deployments/myApp|deployment.xml#Classloader_1)
  6. Associate the shared library in the application through the class loader. For example:
    • Using Jacl:
      $AdminConfig create LibraryRef $classLoad1 {{libraryName MyshareLibrary}}
    • Using Jython:
      print AdminConfig.create('LibraryRef', classLoad1, [['libraryName', 'MyshareLibrary']])
    Table 7. create LibraryRef command elements. Run the create command to create a library reference.
    Element Description
    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object representing the WebSphere Application Server configuration
    create is an AdminConfig command
    LibraryRef is an AdminConfig object
    classLoad1 evaluates to the ID of class loader specified in step number 4
    libraryName is an attribute
    MyshareLibrary is the value of the libraryName attribute
    Example output:
    (cells/mycell/applications/myApp.ear/deployments/myApp|deployment.xml#LibraryRef_1)
  7. Save the configuration changes.
    다음 명령 예제를 사용하여 구성 변경사항을 저장하십시오.
    AdminConfig.save()
  8. Synchronize the node.
    AdminNodeManagement 스크립트 라이브러리에 있는 syncActiveNode 또는 syncNode 스크립트를 사용하여 구성 변경사항을 노드에 전파하십시오.
    • 다음 명령 데모에 표시된 것과 같이, syncActiveNodes 스크립트를 사용하여 변경사항을 셀 내의 각 노드에 전파하십시오.
      AdminNodeManagement.syncActiveNodes()
    • 다음 명령 데모에 표시된 것과 같이, syncNode 스크립트를 사용하여 변경사항을 특정 노드에 전파하십시오.
      AdminNodeManagement.syncNode("myNode")

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



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