アプリケーションの開始は、管理コンソール、 wsadmin ツール、またはプログラミングによって行うことができます。この例を使用し、プログラミングによってアプリケーションを 開始します。
WebSphere Application Server 上でアプリケーションを開始する前に、まずアプリケーションをインストールする必要があります。
以下のタスクを実行し、プログラミングによってアプリケーションを開始します。
以下の例には、リストされた前のステップに従ったアプリケーションの開始方法が示されています。 一部のステートメントは印刷目的のために複数行に分割されています。
//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 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)