Querying the application state using scripting
Use the wsadmin tool and scripting to determine if an application is running. Before starting this task, the wsadmin tool must be running. See the Start the wsadmin scripting client article for more information.
Overview
The following example queries the presence of the Application MBean to find out whether the application is running.
Procedure
- Use Jacl:
$AdminControl completeObjectName type=Application,name=myApplication,*
- Use Jython:
print AdminControl.completeObjectName('type=Application,name=myApplication,*')where:
$ Jacl operator for substituting a variable name with its value AdminControl object that enables the manipulation of MBeans running in a WAS process completeObjectName AdminControl command type=Application,name=myApplication hierarchical containment path of the configuration object Jython command
Results
If myApplication is running, then an MBean is created. Otherwise, the command returns nothing. If myApplication is running, the output would resemble the following: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
Use the AdminControl object for scripted administration
Related Reference
Commands for the AdminControl object