Configuring classloader in websphere

ibm websphere
Below JACL script can be used for configuring classloader in websphere and querying Mbeans too.
#--------------------------------------------------------------------------------
#-- Configuring classloader 
#--------------------------------------------------------------------------------

set aServer [$AdminConfig getid /Node:myNode/Server:newServer/]
set aAppServer [$AdminConfig list ApplicationServer $aServer]
# configure general properties
# valid values for applicationClassLoaderPolicy property are MULTIPLE and SINGLE
set policyAttr [list applicationClassLoaderPolicy SINGLE]
# valid values for applicationClassLoadingMode property are PARENT_FIRST and PARENT_LAST
set modeAttr [list applicationClassLoadingMode PARENT_FIRST]
set attrs [list $policyAttr $modeAttr]
puts "Modify classloader policy and mode property"
$AdminConfig modify $aAppServer $attrs

# check if there is existing class loader
set classloaders [lindex [$AdminConfig showAttribute $aAppServer classloaders] 0]
if {[llength $classloaders] == 0} {
puts "Create a new class loader"
set aClassloader [$AdminConfig create Classloader $aAppServer [list [list mode PARENT_FIRST]]]
puts [$AdminConfig showall $aClassloader]

puts "Associate an existing shared library with this application server"
set nameAttr [list libraryName mySharedLibrary]
set sharedAttr [list sharedClassloader true]
set libraryRefAttr [list $nameAttr $sharedAttr]
$AdminConfig create LibraryRef $aClassloader $libraryRefAttr
puts [$AdminConfig showall $aClassloader]
}
$AdminConfig save

#----------------------------------------------------------------------
#-- Querying MBeans 
#----------------------------------------------------------------------
puts "All the MBeans belonging to myServer:"
$AdminControl queryNames process=myServer,cell=myCell, node=myNode,*

puts "\nmyServer Server MBean:"
$AdminControl queryNames type=Server,process=myServer,cell=myCell,node=myNode,*

puts "\nmyServer TransactionService MBean:"
$AdminControl queryNames type=TransactionService,process=myServer,cell=myCell,node=myNode,*

puts "\nmyServer TraceService MBean:"
$AdminControl queryNames type=TraceService,process=myServer,cell=myCell,node=myNode,*

puts "\nmyServer ApplicationManager MBean:"
$AdminControl queryNames type=ApplicationManager,process=myServer,cell=myCell,node=myNode,*

puts "\nmyServer AppManagement MBean:"
$AdminControl queryNames type=AppManagement,process=myServer,cell=myCell,node=myNode,*

puts "\nmyServer SessionManager MBeans (one per application):"
$AdminControl queryNames type=SessionManager,process=myServer,cell=myCell,node=myNode,*

puts "\nmyServer JVM MBean:"
$AdminControl queryNames type=JVM,process=myServer,cell=myCell,node=myNode,* 

In case of any ┬ęCopyright or missing credits issue please check CopyRights page for faster resolutions.

Leave a Reply