+

Search Tips   |   Advanced Search

Stopping applications using wsadmin.sh

Use the wsadmin tool to stop applications.

There are two ways to complete this task. The example in this topic uses the AdminControl object to stop the application. Alternatively, we can use the scripts in the AdminApplication script library to start, stop, and administer your application configurations.


Tasks

  1. Start the wsadmin scripting tool.
  2. Identify the application manager MBean for the server where the application resides, and assign it to the appManager variable.

    • Jacl:
      set appManager [$AdminControl queryNames cell=mycell,node=mynode,type=
      ApplicationManager,process=server1,*]
      
    • Jython:
      appManager = AdminControl.queryNames('cell=mycell,node=mynode,type=
      ApplicationManager,process=server1,*')
      print appManager
      

    Command element Description
    set Jacl command
    appManager Variable name
    $ Jacl operator for substituting a variable name with its value
    AdminControl Enable the manipulation of MBeans running in a WebSphere server process
    queryNames AdminControl command
    cell=mycell,node=mynode,type= ApplicationManager,process=server1 is the hierarchical containment path of the configuration object
    print Jython command

    This command returns the application manager MBean.

    Example output:

    WebSphere:cell=mycell,name=ApplicationManager,mbeanIdentifier=ApplicationManager,
    type=ApplicationManager,node=mynode,process=server1
    
  3. Query the running applications belonging to this server and assign the result to the apps variable.

    • Jacl:
      set apps [$AdminControl queryNames cell=mycell,node=mynode,type=Application,process=server1,*]
      
    • Jython:
      # get line separator 
      import  java.lang.System  as sys
      lineSeparator = sys.getProperty('line.separator')
      
      apps = AdminControl.queryNames('cell=mycell,node=mynode,type=Application,
      process=server1,*').split(lineSeparator)
      print apps
      

    Command element Description
    set Jacl command
    apps variable name
    $ Jacl operator for substituting a variable name with its value
    AdminControl Enable the manipulation of MBeans running in a WebSphere server process
    queryNames AdminControl command
    cell=mycell,node=mynode,type= ApplicationManager,process=server1 is the hierarchical containment path of the configuration object
    print Jython command

    This command returns a list of application Beans.

    Example output:

    WebSphere:cell=mycell,name=adminconsole,mbeanIdentifier=deployment.xml
    #ApplicationDeployment_1,type=Application,node=mynode,Server=server1,
    process=server1,J2EEName=adminconsole
    WebSphere:cell=mycell,name=filetransfer,mbeanIdentifier=deployment.xml
    #ApplicationDeployment_1,type=Application,node=mynode,Server=server1,
    process=server1,J2EEName=filetransfer
    

  4. Stop all the running applications.

    • Jacl:
      foreach app $apps {
           set appName [$AdminControl getAttribute $app name]
           $AdminControl invoke $appManager stopApplication $appName}
      
    • Jython:
      for app in apps:
          appName = AdminControl.getAttribute(app, 'name')
          AdminControl.invoke(appManager, 'stopApplication', appName)
      

    This command stops all the running applications by invoking the stopApplication operation on the MBean, passing in the application name to stop.

Once completing the steps for this task, all running applications on the server are stopped.

  • Restart enterprise applications
  • wsadmin AdminControl
  • Starting applications
  • Application administration scripts
  • Commands for the AdminControl object
  • Stopping business-level applications using scripting