Use scripting and the wsadmin tool to start an application
that is not running.
Before you begin
There are two ways to complete this task. This topic uses
the AdminControl object to start an application. Alternatively, you
can use the scripts in the AdminApplication script library to start,
stop, and manage applications.
Procedure
- Start the wsadmin scripting tool.
- Identify the application manager MBean for the server where
the application resides and assign it the appManager variable. The
following example returns the name of the application manager MBean.
Using Jacl:
set appManager [$AdminControl queryNames cell=mycell,node=mynode,type
=ApplicationManager,
process=server1,*]
Using Jython:
appManager = AdminControl.queryNames('cell=mycell,node=mynode,type
=ApplicationManager,
process=server1,*')
print appManager
Table 1. queryNames command elements . Run the queryNames command to get the name of the application
manager MBean.
Command element |
Description |
set |
is a Jacl command |
appManager |
is a variable name |
$ |
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® Application Server
process |
queryNames |
is an AdminControl command |
cell=mycell,node=mynode,type=ApplicationManager ,process=server1 |
is the hierarchical containment
path of the configuration object |
print |
is a Jython command |
Example output:
WebSphere:cell=mycell,name=ApplicationManager,mbeanIdentifier=ApplicationManager,
type=ApplicationManager,node=mynode,process=server1
- Start the application. The following example invokes the
startApplication operation on the MBean, providing the application
name that you want to start.
Using Jacl:
$AdminControl invoke $appManager startApplication myApplication
Using Jython:
AdminControl.invoke(appManager, 'startApplication', 'myApplication')
Table 2. invoke command elements . Run the
invoke command to start the application.
Command element |
Description |
$ |
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 Application Server
process |
invoke |
is an AdminControl command |
appManager |
evaluates to the ID of the server
that is specified in step number 1 |
startApplication |
is an attribute of the modify command |
myApplication |
is the value of the startApplication attribute |