| Oracle® Fusion Middleware Oracle WebLogic Server JMXによるカスタム管理ユーティリティの開発 12c (12.2.1.2.0) E82885-02 |
|
![]() 前 |
![]() 次 |
この章の内容は以下のとおりです。
JMXクライアントが独自のJVM (つまり、WebLogic ServerインスタンスでないJVM)で実行される場合は、クライアントのクラスパスに次のJARファイルを含めます。
WL_HOME\server\lib\wljmxclient.jar
このパスで、WL_HOMEはWebLogic Serverをインストールしたディレクトリです。
このJARには、HTTPプロトコルとIIOPプロトコルのOracle実装が含まれます。Oracle実装を使用する場合は、JMXクライアントが接続リクエストとともにログイン資格証明を送信し、WebLogic Serverのセキュリティ・フレームワークがクライアントを認証します。認証されたクライアントだけが、WebLogic Server MBeanサーバーに登録されているMBeanにアクセスできます。
注意:
HTTPプロトコルとIIOPプロトコルのOracle実装を使用することをお薦めしますが、JMXクライアントでは標準のJDKで定義されているIIOPプロトコルを使用することもできます。「JDKクラスのみを使用したリモート接続」を参照してください。T3プロトコルが指定されている場合、IIOPを使用するようクライアントで自動的に変換されます。
注意:
JDKが変更されたため、WLSはwlclient.jarのみでJMXをサポートしていません。JMXを使用するには、"full client" (weblogic.jar)またはwljmxclientのいずれかを使用する必要があります。
各WebLogic Serverドメインには3種類のMBeanサーバーが含まれており、それぞれのMBeanサーバーが別々のMBean階層へのアクセスを提供します。「MBeanサーバー」を参照してください。
WebLogic MBeanサーバーに接続するには、次の手順に従います。
例4-1のコードに関する以下の点に留意してください。
クラスは、グローバル変数connectionおよびconnectorを使用して、MBeanサーバーへの接続を表します。connection変数およびconnector変数に値を割り当てるinitConnection()メソッドは、クラス内で再利用できる1つの接続を確立するためにクラス・インスタンスごとに一度だけ呼び出される必要があります。
initConnection()メソッドは、クラスがインスタンス化されるときに渡される引数として、(サーバーのリスニング・アドレスとリスニング・ポートとともに)ユーザー名とパスワードを取ります。暗号化されていないユーザー資格証明がコード内に含まれないようにするため、この方法をお薦めします。これらの引数を保持するStringオブジェクトは破棄され、JVMのガベージ・コレクション・ルーチンによってメモリーから削除されます。
クライアントは、jmx.remote.x.request.waiting.timeout環境パラメータを10000に設定するので、MBeanサーバー・メソッド呼出しはすべて、呼出し後10000ミリ秒以内にメソッドが返されなければ、タイムアウトします。
クラスが作業を終了したら、JMXConnector.close()メソッドを呼び出してMBeanサーバーとの接続を閉じる(Java SE 7 API仕様のJMXConnector (http://docs.oracle.com/javase/7/docs/api/javax/management/remote/JMXConnector.html)を参照してください。)
例4-1 ドメイン・ランタイムMBeanサーバーへの接続
public class MyConnection {
private static MBeanServerConnection connection;
private static JMXConnector connector;
private static final ObjectName service;
/*
* Initialize connection to the Domain Runtime MBean Server.
*/
public static void initConnection(String hostname, String portString,
String username, String password) throws IOException,
MalformedURLException {
String protocol = "t3";
Integer portInteger = Integer.valueOf(portString);
int port = portInteger.intValue();
String jndiroot = "/jndi/";
String mserver = "weblogic.management.mbeanservers.domainruntime";
JMXServiceURL serviceURL = new JMXServiceURL(protocol, hostname, port,
jndiroot + mserver);
Hashtable h = new Hashtable();
h.put(Context.SECURITY_PRINCIPAL, username);
h.put(Context.SECURITY_CREDENTIALS, password);
h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES,
"weblogic.management.remote");
h.put("jmx.remote.x.request.waiting.timeout", new Long(10000));
connector = JMXConnectorFactory.connect(serviceURL, h);
connection = connector.getMBeanServerConnection();
}
public static void main(String[] args) throws Exception {
String hostname = args[0];
String portString = args[1];
String username = args[2];
String password = args[3];
MyConnection c= new MyConnection();
initConnection(hostname, portString, username, password);
...
connector.close();
}
}
WebLogic Serverドメインは3種類のMBeanサーバーを保持しており、それぞれのMBeanサーバーが特定の機能を実行します。以下のように、実行しようとしているタスクをサポートしているMBeanサーバーを介してMBeanにアクセスします。
ドメインの構成を変更するには、編集MBeanサーバーを使用します。
保留中の構成MBeanの階層に対する変更をモニターするには、編集MBeanサーバーを使用します。
アクティブな構成MBeanのみをモニターする(ランタイムMBeanはモニターしない)ためには、ランタイムMBeanサーバーを使用します。
ランタイムMBeanサーバーを使用したモニターのほうが、ドメイン・ランタイムMBeanサーバーを使用したモニターより、使用するメモリーとネットワーク・トラフィックの量が小さくなります。(WebLogic Serverは、クライアントが接続を要求するまでドメイン・ランタイムMBeanサーバーを初期化しません。)
ほとんどの場合、ドメイン内のすべてのサーバー・インスタンスは同じ構成データのセットを保持しているため、管理サーバーまたは管理対象サーバーどちらのランタイムMBeanサーバーをモニターするかは重要ではありません。ただし、サーバーを再起動しないと消費できない変更を行うと、サーバーは変更を受け入れなくなり、そのサーバーの構成データが古くなるおそれがあります。この場合、このサーバーのランタイムMBeanサーバーをモニターすることは、その特定のサーバー・インスタンスの構成のみをモニターすることになります。WebLogic Serverドメインの変更、および変更のアクティブ化のプロセスを理解するには、Oracle WebLogic Serverドメイン構成の理解の構成の変更の管理を参照してください。
クライアントが複数のサーバーのランタイムMBeanをモニターする場合や、クライアントが別のJVMで実行されている場合は、ドメイン内の各サーバー・インスタンス上のそれぞれのランタイムMBeanサーバーに個別に接続するのではなく、管理サーバー上のドメイン・ランタイムMBeanサーバーに接続することをお薦めします。
ドメイン・ランタイムMbeanサーバーのMbeanにJMXリスナーとフィルタを登録する場合は、JMXフィルタを、それがモニターするMBeanと同じJVMで実行します。たとえば、ある管理対象サーバー上のMBeanにフィルタを登録する場合は、フィルタをその管理対象サーバーで実行し、フィルタ条件を満たすメッセージのみをリスナーに転送します。
一般的に、ドメイン・ランタイムMBeanサーバーを使用するコードのほうが、各サーバー・インスタンス上のランタイムMBeanサーバーを使用するコードより管理がしやすく安全性も高くなっています。その理由は以下のとおりです。
コードで必要なのは、管理サーバー上のドメイン・ランタイムMBeanサーバーに接続するための1つのURLを作成することだけです。以後、コードですべてのサーバー・インスタンスの値をルックアップしたり、必要に応じて結果をフィルタ処理したりできます。
コードでランタイムMBeanサーバーを使用して複数のサーバー・インスタンス上のMBeanの値を読み込む場合には、各サーバー・インスタンス用のURLを作成する必要があり、URLごとに一意のリスニング・アドレスとリスニング・ポートの組合せが必要になります。
管理サーバーのセキュアな管理ポートを介してWebLogic Serverドメイン内のすべての管理トラフィックをルーティングでき、ファイアウォールを使用して管理対象サーバーの管理ポートへのファイアウォール外部からの接続を回避できます。
ドメイン・ランタイムMBeanサーバーを使用してすべてのJMXリクエストを転送することによるトレード・オフとして、ネットワーク・レイテンシとメモリー使用量の増加のためにパフォーマンスが若干低下します。MBean値を読み込むために各管理対象サーバーのランタイムMBeanサーバーに直接接続すると、管理対象サーバーから値を取得するためにドメイン・ランタイムMBeanサーバーが作成するネットワーク・ホップが削除されます。ただし、大半のネットワーク・トポロジとパフォーマンス要件では、ドメイン・ランタイムMBeanサーバーによって有効化される簡略化されたコード・メンテナンスおよび強化セキュリティが推奨されます。
注意:
JMX通知がMBeansに追加されると、ドメイン・ランタイムMBeanサーバーは大量のメモリーを消費する可能性があります。JMX通知が使用されると、次の2つの場合には、ドメイン内のすべての管理対象サーバーで実行されるすべてのランタイムMBeanサーバーに登録されたすべてのJMXオブジェクト名のコピーを管理サーバーが保持することになります。
WebLogic Serverレベルで、管理対象サーバーの停止の際の未登録MBean通知をシミュレートする場合。
JDK JMXクライアント通知レイヤーにおいて。
次の条件がどちらも当てはまる場合、この問題が発生する可能性は高くなります。
通知リスナーをドメイン・ランタイムMBeanサーバーに追加するため、大きなドメインの管理にEM Fusion Middleware Controlが使用されている。
JMXランタイムMBeanの数を大幅に増やすFusion Middleware製品がドメインに含まれている。これには、ドメイン内で実行されているWebLogic ServerランタイムMBeanサーバー・インスタンス(つまり、管理サーバーとすべての管理対象サーバー)に登録されているMBeanを含む任意の製品が含まれます。(これらの製品には、Coherence、SOA Suite、OSBなどがあります。)
このような特定のスケーリング問題を排除するには、managed-server-notifications-enabled属性を無効にします。この構成属性は、管理対象サーバー・ランタイムMBeanサーバーに含まれるMBeanで通知を定義する機能を無効にします(これらのMBeanのObjectNameにはLocation=keyが含まれています)。
管理対象サーバー通知が無効になると、WebLogic ServerおよびJDKコンポーネントに含まれるMBeanの2つのObjectNameセットが保持されなくなります。通知リスナーは、MBeanServerDelegateや、ローカルのドメイン・ランタイムMBeanサーバーに含まれるMBeanでも定義できます。ただし、通知リスナーをローカルでないMBeanに追加することはできません。
managed-server-notifications-enabled属性は、WLSTを使用して、次のように設定できます。
edit()
startEdit()
cd("JMX/domain-name")
cmo.setManagedServerNotificationsEnabled(false)
activate()
リモートJMXクライアントからの接続ではWebLogic Serverクラスを使用することをお薦めします。ただし、リモートJMXクライアントでJDKのクラスのみを使用してWebLogic Server JMXエージェントに接続することもできます。そのためには、次の手順に従います。
wljmxclient.jarとwlclient.jarをクライアント・クラスパスに指定しない場合:
MBeanをホストするWebLogic ServerインスタンスのIIOPプロトコルを有効にします。
管理者権限を持つWebLogic Serverユーザーになるように、デフォルトのIIOPユーザーを構成します。
Oracle WebLogic Server管理コンソール・オンライン・ヘルプのIIOPの有効化と構成を参照してください。
wljmxclient.jarとwlclient.jarがクライアント・クラスパスに存在する場合、デフォルトのIIOPユーザーを有効にする必要はありません。ステップ2に進みます。
注意:
wlclient.jarはwljmxclient.jarのMANIFEST ClassPathエントリにあるので、wlclient.jarとwljmxclient.jarは同じディレクトリにあるか、または両方のjarはクラスパスで指定する必要があります。
クラスパスにwljmxclient.jarがある場合、weblogic.jarまたはwlfullclient.jarは、クラスパスに含まれていないことを確認してください。シン・クライアントwljmxclient.jar/wlclient.jarまたはシック・クライアントwlfullclient.jarのみ使用し、両方のクライアントを組み合せて使用しないでください。
JMXクライアントで、javax.management.JMXConnectorオブジェクトを次のように作成します。
String hostname = "WLS-host" int port = WLS-port String protocol = "iiop"; String jndiroot= new String("/jndi/iiop://" + hostname + ":" + port + "/"); String mserver = "MBean-server-JNDI-name"; JMXServiceURL serviceURL = new JMXServiceURL(protocol, hostname, port, jndiroot + mserver); Hashtable h = new Hashtable(); h.put(Context.SECURITY_PRINCIPAL, username); h.put(Context.SECURITY_CREDENTIALS, password); connector = JMXConnectorFactory.connect(serviceURL, h);
WLS-hostとWLS-portはWebLogic Serverインスタンスのリスニング・アドレスとリスニング・ポートであり、MBean-server-JNDI-nameは表4-1に示した値のいずれかです。
作成するハッシュ表には、プロトコル・パッケージの名前が含まれていません。この値をnullのままにしておくことで、JMXクライアントはJDKのcom.sun.jmx.remote.protocolパッケージからプロトコル定義を使用します。
ローカル・クライアントは、JMXServiceURLオブジェクトを作成するのではなく、JNDIツリーを介してWebLogic ServerインスタンスのランタイムMBeanサーバーにアクセスできます。
注意:
「ドメイン実行時MBeanサーバーへのローカル接続の作成」の説明に従って、ローカル・クライアントは、JNDIツリーを介してWebLogic Serverのドメイン実行時MBeanサーバーにもアクセスできます。
JNDIからアクセスされると、ランタイムMBeanサーバーはそのjavax.management.MBeanServerインタフェースを返します。このインタフェースには、MBeanServerConnectionインタフェースのすべてのメソッドと、ローカル・プロセスがカスタムMBeanの登録に使用するregisterMBean()などの追加のメソッドがあります。(Java SE 7 API仕様のMBeanServer (http://docs.oracle.com/javase/7/docs/api/javax/management/MBeanServer.html)を参照してください。)
JMXクライアントのクラスが、EJBまたはWebアプリケーションなどのJava EEモジュールにある場合、ランタイムMBeanServerのJNDI名は次のようになります。
java:comp/env/jmx/runtime
例:
InitialContext ctx = new InitialContext();
server = (MBeanServer)ctx.lookup("java:comp/env/jmx/runtime");
JMXクライアントのクラスがJava EEモジュールの一部ではない場合、ランタイムMBeanサーバーのJNDI名は次のようになります。
java:comp/jmx/runtime
ローカル・クライアントは、JMXServiceURLオブジェクトを作成するのではなく、JNDIツリーを介してWebLogic Serverインスタンスのドメイン・ランタイムMBeanサーバーにアクセスできます。
JNDIからアクセスされると、ドメイン・ランタイムMBeanサーバーはそのjavax.management.MBeanServerインタフェースを返します。このインタフェースには、MBeanServerConnectionインタフェースのすべてのメソッドと、ローカル・プロセスがカスタムMBeanの登録に使用するregisterMBean()などの追加のメソッドの他にgetMBeanCount()、instatiate()、とgetClassLoader()などのメソッドもあります。(Java SE 7 API仕様のMBeanServer (http://docs.oracle.com/javase/7/docs/api/javax/management/MBeanServer.html)を参照してください。)
注意:
ベスト・プラクティスとして、Oracleでは、ドメイン・ランタイムMBeanサーバーをドメイン全体の操作を実行するMBeanにのみ使用することをお薦めします。MBeanの処理とネットワーク・アクティビティにより管理サーバーの処理速度が低下し、管理操作の開始が回避されていないことを確認してください。
JMXクライアントのクラスが、EJBまたはWebアプリケーションなどのJava EEモジュールにある場合、ドメイン・ランタイムMBeanServerのJNDI名は次のようになります。
java:comp/env/jmx/domainRuntime
例:
InitialContext ctx = new InitialContext();
server = (MBeanServer)ctx.lookup("java:comp/env/jmx/domainRuntime");
JMXクライアントのクラスがJava EEモジュールの一部ではない場合、ドメイン・ランタイムMBeanサーバーのJNDI名は次のようになります。
java:comp/jmx/domainRuntime
ドメイン・ランタイムMBeanサーバーは、管理サーバー上にのみ存在します。呼出しctx.lookup()は、ローカルMBeanServerに参照を返すため、ルックアップ・メソッドは管理サーバー上で実行する場合にのみ呼び出すことができます。管理対象サーバー上で実行するときに呼び出された場合、NameNotFound例外がスローされます。
WebLogic Serverは、MBeanを階層データ・モデルにまとめます。(WebLogic Server MBeanのデータ・モデルを参照してください。)このモデルでは、すべての親MBeanにその子のオブジェクト名を含んだ属性が含まれています。標準のJMX APIで子のオブジェクト名を使用して、子MBeanの属性の値を取得または設定したり、そのメソッドを呼び出したりします。
WebLogic Server MBean階層を移動するには、次の手順に従います。
MBean階層でのMBeanの場所を特定するには、Oracle WebLogic Server MBeanリファレンスでそのMBeanの説明を参照してください。Oracle WebLogic Server MBeanリファレンスでは、各MBeanについて、現在のMBeanのファクトリ・メソッドを保持する親MBeanが記載されています。ファクトリ・メソッドがパブリックでないMBeanについては、Oracle WebLogic Server MBeanリファレンスに、現在のMBeanにアクセスできる他のMBeanが記載されています。
例4-2のサンプル・コードでは、ドメイン・ランタイムMBeanサーバーに接続し、DomainRuntimeServiceMBeanを使用してドメイン内の各ServerRuntimeMBeanのオブジェクト名を取得します。その後、各サーバーのServerRuntimeMBeanのName属性およびState属性の値を取得し、出力します。
例4-2のコードに関する以下の点に留意してください。
クラスは、connectionグローバル変数とconnectorグローバル変数に加えて、WebLogic ServerサービスMBeanのオブジェクト名をグローバル変数に割り当てます。クラス内のメソッドはこのオブジェクト名を頻繁に使用します。このオブジェクト名は一度定義したら、変更する必要はありません。
printServerRuntimes()メソッドは、ドメイン内のすべてのServerRuntimeMBeanインスタンスの配列を保持するDomainRuntimeServiceMBeanのServerRuntimes属性の値を取得します。(Oracle WebLogic Server MBeanリファレンスのDomainRuntimeServiceMBeanを参照してください。)
例4-2 例:サーバーの名前と状態の出力
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Hashtable;
import javax.management.MBeanServerConnection;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import javax.naming.Context;
public class PrintServerState {
private static MBeanServerConnection connection;
private static JMXConnector connector;
private static final ObjectName service;
// Initializing the object name for DomainRuntimeServiceMBean
// so it can be used throughout the class.
static {
try {
service = new ObjectName(
"com.bea:Name=DomainRuntimeService,Type=weblogic.management.
mbeanservers.domainruntime.DomainRuntimeServiceMBean");
}catch (MalformedObjectNameException e) {
throw new AssertionError(e.getMessage());
}
}
/*
* Initialize connection to the Domain Runtime MBean Server
*/
public static void initConnection(String hostname, String portString,
String username, String password) throws IOException,
MalformedURLException {
String protocol = "t3";
Integer portInteger = Integer.valueOf(portString);
int port = portInteger.intValue();
String jndiroot = "/jndi/";
String mserver = "weblogic.management.mbeanservers.domainruntime";
JMXServiceURL serviceURL = new JMXServiceURL(protocol, hostname,
port, jndiroot + mserver);
Hashtable h = new Hashtable();
h.put(Context.SECURITY_PRINCIPAL, username);
h.put(Context.SECURITY_CREDENTIALS, password);
h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES,
"weblogic.management.remote");
connector = JMXConnectorFactory.connect(serviceURL, h);
connection = connector.getMBeanServerConnection();
}
/*
* Print an array of ServerRuntimeMBeans.
* This MBean is the root of the runtime MBean hierarchy, and
* each server in the domain hosts its own instance.
*/
public static ObjectName[] getServerRuntimes() throws Exception {
return (ObjectName[]) connection.getAttribute(service,
"ServerRuntimes");
}
/*
* Iterate through ServerRuntimeMBeans and get the name and state
*/
public void printNameAndState() throws Exception {
ObjectName[] serverRT = getServerRuntimes();
System.out.println("got server runtimes");
int length = (int) serverRT.length;
for (int i = 0; i < length; i++) {
String name = (String) connection.getAttribute(serverRT[i],
"Name");
String state = (String) connection.getAttribute(serverRT[i],
"State");
System.out.println("Server name: " + name + ". Server state: "
+ state);
}
}
public static void main(String[] args) throws Exception {
String hostname = args[0];
String portString = args[1];
String username = args[2];
String password = args[3];
PrintServerState s = new PrintServerState();
initConnection(hostname, portString, username, password);
s.printNameAndState();
connector.close();
}
}
Webアプリケーションの各サーブレットは、サーブレットのランタイムの状態についての情報を保持するServletRuntimeMBeanのインスタンスを提供します。(Oracle WebLogic Server MBeanリファレンスのServletRuntimeMBeanを参照してください。)
WebLogic Serverのデータ・モデルでは、ServletRuntimeMBeanへのパスは次のようになります。
例4-3 サーブレットのモニター
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Hashtable;
import javax.management.MBeanServerConnection;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import javax.naming.Context;
public class MonitorServlets {
private static MBeanServerConnection connection;
private static JMXConnector connector;
private static final ObjectName service;
// Initializing the object name for DomainRuntimeServiceMBean
// so it can be used throughout the class.
static {
try {
service = new ObjectName(
"com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanser
vers.domainruntime.DomainRuntimeServiceMBean");
}catch (MalformedObjectNameException e) {
throw new AssertionError(e.getMessage());
}
}
/*
* Initialize connection to the Domain Runtime MBean Server
*/
public static void initConnection(String hostname, String portString,
String username, String password) throws IOException,
MalformedURLException {
String protocol = "t3";
Integer portInteger = Integer.valueOf(portString);
int port = portInteger.intValue();
String jndiroot = "/jndi/";
String mserver = "weblogic.management.mbeanservers.domainruntime";
JMXServiceURL serviceURL = new JMXServiceURL(protocol, hostname,
port, jndiroot + mserver);
Hashtable h = new Hashtable();
h.put(Context.SECURITY_PRINCIPAL, username);
h.put(Context.SECURITY_CREDENTIALS, password);
h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES,
"weblogic.management.remote");
connector = JMXConnectorFactory.connect(serviceURL, h);
connection = connector.getMBeanServerConnection();
}
/*
* Get an array of ServerRuntimeMBeans
*/
public static ObjectName[] getServerRuntimes() throws Exception {
return (ObjectName[]) connection.getAttribute(service,
"ServerRuntimes");
}
/*
* Get an array of WebAppComponentRuntimeMBeans
*/
public void getServletData() throws Exception {
ObjectName[] serverRT = getServerRuntimes();
int length = (int) serverRT.length;
for (int i = 0; i < length; i++) {
ObjectName[] appRT =
(ObjectName[]) connection.getAttribute(serverRT[i],
"ApplicationRuntimes");
int appLength = (int) appRT.length;
for (int x = 0; x < appLength; x++) {
System.out.println("Application name: " +
(String)connection.getAttribute(appRT[x], "Name"));
ObjectName[] compRT =
(ObjectName[]) connection.getAttribute(appRT[x],
"ComponentRuntimes");
int compLength = (int) compRT.length;
for (int y = 0; y < compLength; y++) {
System.out.println(" Component name: " +
(String)connection.getAttribute(compRT[y], "Name"));
String componentType =
(String) connection.getAttribute(compRT[y], "Type");
System.out.println(componentType.toString());
if (componentType.toString().equals("WebAppComponentRuntime")){
ObjectName[] servletRTs = (ObjectName[])
connection.getAttribute(compRT[y], "Servlets");
int servletLength = (int) servletRTs.length;
for (int z = 0; z < servletLength; z++) {
System.out.println(" Servlet name: " +
(String)connection.getAttribute(servletRTs[z],
"Name"));
System.out.println(" Servlet context path: " +
(String)connection.getAttribute(servletRTs[z],
"ContextPath"));
System.out.println(" Invocation Total Count : " +
(Object)connection.getAttribute(servletRTs[z],
"InvocationTotalCount"));
}
}
}
}
}
}
public static void main(String[] args) throws Exception {
String hostname = args[0];
String portString = args[1];
String username = args[2];
String password = args[3];
MonitorServlets s = new MonitorServlets();
initConnection(hostname, portString, username, password);
s.getServletData();
connector.close();
}
}
例4-3のコードでは、上記の節で説明したように階層を移動し、ServletRuntimeMBean属性の値を取得します。