Example: Configuring a shared library for an application
Use the AdminApp object to set certain configurations in the application. This example uses the AdminConfig object to configure a shared library for an application.
- Identify the shared library and assign it to the library variable.
- To create a new shared library, perform the following steps:
- Idenitfy the node and assign it to a variable, for example:
set node [$AdminConfig getid /Cell:mycell/Node:mynode/]Example output:mynode(cells/mycell/nodes/mynode:node.xml#Node_1)- Create the shared library in the node, for example:
set library [$AdminConfig create Library $node {{name mySharedLibrary} {classPath c:/mySharedLibraryClasspath}}]Example output:MySharedLibrary(cells/mycell/nodes/mynode:libraries.xml#Library_1)This example creates a new shared library in the node scope. You can modify it to use the cell or server scope.- To use an existing shared library, issue the following command:
set library [$AdminConfig getid /Library:mySharedLibrary/]Example output:MySharedLibrary(cells/mycell/nodes/mynode:libraries.xml#Library_1)
- Identify the deployment configuration object for the application and assign it to the deployment variable:
set deployment [$AdminConfig getid /Deployment:myApp/]Example output:myApp(cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#Deployment_1)- Retrieve the applicaton deployment and assign it to the appDeploy variable:
set appDeploy [$AdminConfig showAttribute $deployment deployedObject]Example output:(cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#ApplicationDeployment_1)- Idenitfy the class loader in the application deployment and assign it to the classLoader variable:
set classLoader [$AdminConfig showAttribute $appDeploy classloader]Example output:(cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#Classloader_1)- Associate the shared library in the application through the class loader:
$AdminConfig create LibraryRef $classLoader {{libraryName MyshareLibrary} {sharedClassloader true}}Example output:(cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#LibraryRef_1)- Save the changes:
$AdminConfig save