Using wsadmin to create a shared library and associate it with an application
 Technote (troubleshooting)
 
Problem(Abstract)
How do I create a shared library and associate it with an application using wsadmin in WebSphere version 5.0.x?
 
Resolving the problem
This can be done through the console but is also easily to do using the scripting tool, wsadmin, which is new with WebSphere 5.0.x.
Determine the scope of the shared library and get the appropriate ID.

In the examples below, each command is followed by sample output.

Getting an ID:
  • Example for getting cell ID:
    wsadmin>set cell [$AdminConfig getid /Cell:murcielago/]

    murcielago(cells/murcielago:cell.xml#Cell_1)

  • Example for getting server ID:
    wsadmin>set server [$AdminConfig getid /Cell:murcielago/Node:murcielago/Server:server1/]

    server1(cells/murcielago/nodes/murcielago/servers/server1:server.xml#Server_1)


Working with ID to create and manage shared library:
  1. Create the shared library
    wsadmin>$AdminConfig create Library $server {{name testlib} {classPath c:\temp}}

    testlib(cells/murcielago/nodes/murcielago/servers/server1:libraries.xml#Library_1066957364688)

  2. Set the application deployments to which to connect the library
    wsadmin>set deployments [$AdminConfig getid /Deployment:DefaultApplication/]

    DefaultApplication(cells/murcielago/applications/DefaultApplication.ear/deployments/DefaultApplication:deployment.xml#Deployment_1)

  3. Get the deployment object
    wsadmin>set deploymentObject [$AdminConfig showAttribute $deployments deployedObject]

    (cells/murcielago/applications/DefaultApplication.ear/deployments/DefaultApplication:deployment.xml#ApplicationDeployment_1)

  4. Get the classloader object
    wsadmin>set classloader [$AdminConfig showAttribute $deploymentObject classloader]

    (cells/murcielago/applications/DefaultApplication.ear/deployments/DefaultApplication:deployment.xml#Classloader_1)

  5. Create the library and connect it to the one created previously
    wsadmin>$AdminConfig create LibraryRef $classloader {{libraryName testlib}}

    (cells/murcielago/applications/DefaultApplication.ear/deployments/DefaultApplication:deployment.xml#LibraryRef_1066957692406)

  6. Save the configuration
    wsadmin>$AdminConfig save
 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Administrative Scripting Tools (for example: wsadmin or ANT)
Operating system(s): Windows
Software version: 5.0
Software edition:
Reference #: 1143359
IBM Group: Software Group
Modified date: Jun 23, 2004