Querying application state using scripting

 

Querying application state using scripting

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

The following example queries for the presence of Application MBean to find out whether the application is running. Using Jacl:

$AdminControl completeObjectName type=Application,name=myApplication,*
Using Jython:
print AdminControl.completeObjectName('type=Application,name=myApplication,*')
where:

$ is a Jacl operator for substituting a variable name with its value
AdminControl is an object that enables the manipulation of MBeans running in a WebSphere server process
completeObjectName is an AdminControl command
type=Application,name=myApplication is the hierarchical containment path of the configuration object
print is a Jython command

Result

If myApplication is running, then there should be an MBean created for it. Otherwise, the command returns nothing. If myApplication is running, the following is the example output:

WebSphere:cell=mycell,name=myApplication,mbeanIdentifier=cells/mycell/applications/myApplication.ear/deployments/myApplication/deployment.xml#ApplicationDeployment_1,type=Application,node=mynode,Server=dmgr,process=dmgr,J2EEName=myApplication



Related concepts
AdminControl object for scripted administration

Related reference
Commands for the AdminControl object