プログラミングによるアプリケーションの開始

アプリケーションの開始は、管理コンソール、 wsadmin ツール、またはプログラミングによって行うことができます。この例を使用し、プログラミングによってアプリケーションを 開始します。

始める前に

このタスクでは、MBean プログラミングに関する基本的な知識があることが前提になっています。MBean プログラミングについて詳しくは、MBean Java™ アプリケーション・プログラミング・インターフェース (API) に関する文書を参照してください。このインフォメーション・センターで、「参照」 > 「プログラミング・インターフェース」 > 「Mbean インターフェース」の順にクリックします。

WebSphere® Application Server 上でアプリケーションを開始する前に、アプリケーションをインストールする必要があります。

このタスクについて

以下のタスクを実行し、プログラミングによってアプリケーションを開始します。

手順

  1. 管理クライアントを WebSphere Application Server に接続します。
  2. アプリケーション管理プロキシーを作成します。
  3. アプリケーション名、およびオプションでアプリケーションを開始するターゲットのリスト を渡すことによって、プロキシー上で startApplication メソッドを呼び出します。

タスクの結果

コードが正常に実行されると、アプリケーションが開始されます。

以下の例には、リストされた前のステップに従ったアプリケーションの開始方法が示されています。 一部のステートメントは印刷目的のために複数行に分割されています。

//Do a get of the administrative client to connect to
//WebSphere Application Server.

AdminClient client = ...;
String appName = "myApp";
Hashtable prefs = new Hashtable();
// Use the AppManagement MBean to start and stop applications on all or some targets.
// The AppManagement MBean is on the deployment manager in the WebSphere Application Server Network Deployment product.

// Query and get the AppManagement MBean.
ObjectName on = new ObjectName ("WebSphere:type=AppManagement,*");
Iterator iter = client.queryNames (on, null).iterator();
ObjectName appmgmtON = (ObjectName)iter.next();
			
//Start the application on all targets.
AppManagement proxy = AppManagementProxy.getJMXProxyForClient(client);
String started = proxy.startApplication(appName, prefs, null);
System.out.println("Application started on folloing servers: " + started);
			
//Start the application on some targets.
//String targets = "WebSphere:cell=cellname,node=nodename,
server=servername+WebSphere:cell=cellname,cluster=clusterName";
//String started1 = proxy.startApplication(appName, targets, prefs, null);
//System.out.println("Application started on following servers: " + started1)

トピックのタイプを示すアイコン タスク・トピック



タイム・スタンプ・アイコン 最終更新: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tjmx_start_app
ファイル名:tjmx_start_app.html