WebSphere Application Server - Express, Version 6.0.x     Operating Systems: AIX, HP-UX, Linux, Solaris, Windows

Configuring a shared library using scripting

Before you begin

Before starting this task, the wsadmin tool must be running. See the Starting the wsadmin scripting client article for more information.

Why and when to perform this task

Perform the following steps to configure an application server to use a shared library.

Steps for this task

  1. Identify the server and assign it to the server variable. For example:
    • Using Jacl:

      set serv [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
    • Using Jython:
      serv = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:server1/')
      print serv
    where:
    set is a Jacl command
    serv 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
    Cell is an attribute
    mycell is the value of the attribute
    Node is an attribute
    mynode is the value of the attribute
    Server is an attribute
    server1 is the value of the attribute
    Example output:
    server1(cells/mycell/nodes/mynode/servers/server1|server.xml#Server_1)
  2. Create the shared library in the server. For example:
    • Using Jacl:

      $AdminConfig create Library $serv {{name mySharedLibrary} {classPath c:/mySharedLibraryClasspath}}
    • Using Jython:

      print AdminConfig.create('Library', serv, [['name', 'mySharedLibrary'], ['classPath',  'c:/mySharedLibraryClasspath']])
      
    where:
    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object that represents the WebSphere Application Server configuration
    create is an AdminConfig command
    Library is an attribute
    serv evaluates the ID of the server that is specified in step number 1
    name is an attribute
    mySharedLibrary is a value of the name attribute
    classPath is an attribute
    /mySharedLibraryClasspath is the value of the classpath attribute
    print is a Jython command
    Example output:
    MysharedLibrary(cells/mycell/nodes/mynode/servers/server1|libraries.xml#Library_1)
  3. Identify the application server from the server and assign it to the appServer variable. For example:
    • Using Jacl:

      set appServer [$AdminConfig list ApplicationServer $serv]
    • Using Jython:
      appServer = AdminConfig.list('ApplicationServer', serv)
      print appServer
    where:
    set is a Jacl command
    appServer 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
    list is an AdminConfig command
    ApplicationServer is an attribute
    serv evaluates the ID of the server that is specified in step number 1
    print is a Jython command
    Example output:
    server1(cells/mycell/nodes/mynode/servers/server1|server.xml#ApplicationServer_1
  4. Identify the class loader in the application server and assign it to the classLoader variable. For example:
    • To use the existing class loader that is associated with the server, the following commands use the first class loader:
      • Using Jacl:

        set classLoad [$AdminConfig showAttribute $appServer classloaders]
        set classLoader1 [lindex $classLoad 0]
      • Using Jython:
        classLoad = AdminConfig.showAttribute(appServer, 'classloaders')
        cleanClassLoaders = classLoad[1:len(classLoad)-1]
        classLoader1 = cleanClassLoaders.split(' ')[0]
      where:
      set is a Jacl command
      classLoad, classLoader1 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
      appServer evaluates the ID of the application server that is specified in step number 3
      classloaders is an attribute
      print is a Jython command
    • To create a new class loader, issue the following command:
      • Using Jacl:

        set classLoader1 [$AdminConfig create Classloader $appServer {{mode PARENT_FIRST}}]
      • Using Jython:
        classLoader1 = AdminConfig.create('Classloader', appServer, [['mode',  'PARENT_FIRST']])
    where:
    set is a Jacl command
    classLoader1 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
    create is an AdminConfig command
    Classloader is an attribute
    appServer evaluates the ID of the application server that is specified in step number 3
    mode is an attribute
    PARENT_FIRST is the value of the attribute
    print is a Jython command
    Example output:
    (cells/mycell/nodes/mynode/servers/server1|server.xml#Classloader_1)
  5. Associate the shared library that you created with the application server through the class loader. For example:
    • Using Jacl:

      $AdminConfig create LibraryRef $classLoader1 {{libraryName MyshareLibrary} {sharedClassloader true}}
    • Using Jython:
      print AdminConfig.create('LibraryRef', classLoader1, [['libraryName', 'MyshareLibrary'],  ['sharedClassloader', 'true']])
    where:
    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object that represents the WebSphere Application Server configuration
    create is an AdminConfig command
    LibraryRef is an attribute
    classLoader1 evaluates the ID of the class loader that is specified in step number 4
    libraryName is an attribute
    MyshareLibrary is the value of the attribute
    sharedClassloader is an attribute
    true is the value of the attribute
    print is a Jython command
    Example output:
    (cells/mycell/nodes/mynode/servers/server1|server.xml#LibraryRef_1)
  6. Save the configuration changes. See the Saving configuration changes with the wsadmin tool article for more information.
  7. In a Network Deployment environment only, synchronize the node. See the Synchronizing nodes with the wsadmin tool article for more information.



Related concepts
AdminConfig object for scripted administration

Related tasks
Configuring a shared library for an application using scripting

Related reference
Commands for the AdminConfig object

Task topic    

Terms of Use | Feedback

Last updated: Jun 8, 2005 12:45:23 PM EDT
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/txml_library.html

© Copyright IBM Corporation 2004, 2005. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)