Example: Configuring a shared library using wsadmin
The following example configures an application server to use a shared library.
- Identify the server and assign it to the server variable:
set server [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]Example output:
server1(cells/mycell/nodes/mynode/servers/server1:server.xml#Server_1)- Create the shared library in the server:
$AdminConfig create Library $server {{name mySharedLibrary} {classPath c:/mySharedLibraryClasspath}}Example output:
MyshareLibrary(cells/mycell/nodes/mynode/servers/server1:libraries.xml#Library_1)- Identify the application server from the server and assign it to the appServer variable:
set appServer [$AdminConfig list ApplicationServer $server]Example output:
server1(cells/mycell/nodes/mynode/servers/server1:server.xml#ApplicationServer_1- Identify the class loader in the application server and assign it to the classLoader variable.
To use the existing class loader associated with the server, the following commands use the first class loader:
set classLoaders [$AdminConfig showAttribute $appServer classloaders] set classLoader [lindex $classLoaders 0]Create a new class loader, by doing the following:
set classLoader [$AdminConfig create Classloader $appServer {{mode PARENT_FIRST}}]Example output:
(cells/mycell/nodes/mynode/servers/server1:server.xml#Classloader_1)- Associate the created shared library with the application server through the class loader.
$AdminConfig create LibraryRef $classLoader {{libraryName MyshareLibrary} {sharedClassloader true}}Example output:
(cells/mycell/nodes/mynode/servers/server1:server.xml#LibraryRef_1)- Save the changes with the following command:
$AdminConfig save