Querying the application state using wsadmin scripting

Use the wsadmin tool and scripting to determine if an application is running.

Before you begin

There are two ways to complete this task. The example in this topic uses the AdminConfig object to create and configure a shared library. Alternatively, you can use the createSharedLibrary script in the AdminResources script library to configure shared libraries.

Scripting 程式庫提供一組自動執行最常見管理功能的程序。 您可以個別執行每個 Script 程序,也可以將若干程序結合起來,以快速開發新的 Script。

Procedure

  1. 啟動 wsadmin Scripting 工具。
  2. Determine the application state.
    The following example queries the presence of the 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,*')
    Table 1. completeObjectName command elements. Run the completeObjectName command to see if an application is running.
    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
    completeObjectName is an AdminControl command
    type=Application,name=myApplication is the hierarchical containment path of the configuration object
    print is a Jython command

Results

If myApplication is running, then an MBean is created. Otherwise, the command returns nothing. If myApplication is running, the output resembles 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

指出主題類型的圖示 作業主題



時間戳記圖示 前次更新: July 9, 2016 11:18
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=txml_appstate
檔名:txml_appstate.html