WebLogic Scripting Tool ガイド

     前  次    新しいウィンドウで目次を開く     
ここから内容の開始

MBean の移動 (WLST オンライン)

以下の節では、WLST を使用して MBean を移動、照会、および編集する方法について説明します。

 


MBean の移動と照会

WLST オンラインでは、MBean に簡単にアクセスできます。JMX API では、MBean に対して照会を行なうために JMX オブジェクト名を使用する必要がありますが、WLST では、ファイル システム内のファイルの階層を移動するのと同様なやり方で、MBean の階層を移動できます。

WebLogic Server は、MBean を階層データ モデルにまとめます。WLST ファイル システムでは、MBean 階層はドライブに、MBean タイプとインスタンスはディレクトリに、MBean 属性とオペレーションはファイルに相当します。UNIX または Windows コマンド シェルでファイル システムを移動するときと同じように、WLST は cdlspwd などのコマンドを使用して、MBean の階層構造を移動します。MBean インスタンスに移動したら、WLST コマンドを使用して MBean と対話します。

コンフィグレーション階層において、ルート ディレクトリは DomainMBean (『WebLogic Server MBean リファレンス』の「DomainMBean」を参照)、MBean タイプはルート ディレクトリの下位ディレクトリ、MBean タイプの各インスタンスは MBean タイプ ディレクトリの下位ディレクトリ、MBean 属性およびオペレーションは MBean インスタンス ディレクトリ下のノード (ファイル等) です。MBean インスタンス ディレクトリの名前は、MBean の Name 属性の値と一致します。MBean に Name 属性がない場合、NO_NAME_number の形式でディレクトリ名が生成されます。ここで、number は 0 (ゼロ) から始まり、追加の MBean インスタンスごとに 1 ずつ増分します。

図 5-1 コンフィグレーション MBean 階層

コンフィグレーション MBean 階層

WLST はまず、サーバのコンフィグレーション MBean のルートの WebLogic Server インスタンスに接続します。これは、ルートを DomainMBean とした単一の階層です。WLST コマンドでは、サーバの実行時 MBean、ドメイン全体のサービスのための MBean、ドメイン内のすべてのコンフィグレーション MBean の編集可能なコピーなど、ドメイン内のすべての WebLogic Server MBean 階層にアクセスできます。詳細については、「ツリー コマンド」を参照してください。

MBean 階層の詳細については、『JMX によるカスタム管理ユーティリティの開発』の「WebLogic Server MBean のデータ モデル」を参照してください。

現在の管理オブジェクトの変更

WLST オンラインでは、現在の管理オブジェクトを表す変数 cmo が提供されます。この変数を使用すると、管理オブジェクトの getset、または invoke メソッドを実行できます。たとえば、cmo 変数では、次のコマンドが有効になります。
wls:/mydomain/edit> cmo.setAdministrationPort(9092)

この変数は、カスタムおよび jndi 以外のすべての WLST 階層で利用できます。

WLST では、cmo の値が現在の WLST パスに設定されます。ディレクトリを変更するごとに、cmo の値は現在の WLST パスに再設定されます。たとえば、serverRuntime 階層に変更すると、cmo は ServerRuntime に設定されます。serverConfig 階層に変更すると、cmo は DomainMBean に設定されます。DomainMBean 下の Servers ディレクトリに変更すると、cmo は ServerMBean のインスタンスに設定されます (コード リスト 5-1 を参照)。

コード リスト 5-1 現在の管理オブジェクトの変更
C:\> java weblogic.WLST
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to Weblogic Server Administration Scripting Shell
...
wls:/(offline)> connect('username','password')
Connecting to weblogic server instance running at t3://localhost:7001 as username weblogic ...
Successfully connected to Admin Server 'myserver' that belongs to domain 'mydomain'.
Warning: An insecure protocol was used to connect to the server.
To ensure on-the-wire security, the SSL port or Admin port should be used instead.
wls:/mydomain/serverConfig> cmo
[MBeanServerInvocationHandler]com.bea:Name=mydomain,Type=Domain
wls:/mydomain/serverConfig> cd('Servers')
wls:/mydomain/serverConfig/Servers> cmo
[MBeanServerInvocationHandler]com.bea:Name=mydomain,Type=Domain
wls:/mydomain/serverConfig/Servers> cd('myserver')
wls:/mydomain/serverConfig/Servers/myserver> cmo
[MBeanServerInvocationHandler]com.bea:Name=myserver,Type=Server

WLST 変数の詳細については、「WLST 変数リファレンス」を参照してください。

コンフィグレーション MBean サンプルの移動と表示

コード リスト 5-2 のコマンドは、管理サーバのインスタンスに接続してから、DomainMBean の属性、オペレーション、および子の MBean を表示するよう WLST に指示します。

コード リスト 5-2 コンフィグレーション MBean の移動と表示
C:\> java weblogic.WLST
wls:/offline> connect('username','password')
wls:/mydomain/serverConfig> ls()
dr-- AppDeployments
dr-- BridgeDestinations
dr-- Clusters
dr-- DeploymentConfiguration
dr-- Deployments
dr-- EmbeddedLDAP
...
-r-- AdminServerName myserver
-r-- AdministrationMBeanAuditingEnabled false
-r-- AdministrationPort 9002
-r-- AdministrationPortEnabled false
-r-- AdministrationProtocol t3s
-r-- ArchiveConfigurationCount 5
...
wls:/mydomain/serverConfig> cd('Servers')
wls:/mydomain/serverConfig/Servers> ls()
dr-- managed1
dr-- myserver
wls:/mydomain/serverConfig/Servers> cd('myserver')
wls:/mydomain/serverConfig/Servers/myserver> ls()
dr-- COM
dr-- CandidateMachines
dr-- Cluster
dr-- DefaultFileStore
dr-- ExecutiveQueues
dr-- IIOP
dr-- JTAMigrateableTarget
dr-- Log
dr-- Machine
dr-- NetworkAccessPoints
dr-- OverloadProtection
dr-- SSL
...
-r-- AcceptBacklog 50
-r-- AdminReconnectIntervalSeconds 10
-r-- AdministrationPort 0
-r-- AdministrationPortAfterOverride 9002
-r-- AdministrationPortEnabled false
-r-- AdministrationProtocol t3s
-r-- AutoKillIfFailed false
-r-- AutoRestart true
....
wls:/mydomain/serverConfig/Servers/myserver> cd('Log/myserver')
wls:/mydomain/serverConfig/Servers/myserver/Log/myserver> ls()
dr-- DomainLogBroadcastFilter
dr-- LogFileFilter
dr-- MemoryBufferFilter
dr-- StdoutFilter
-r--   DomainLogBroadcastFilter                     null
-r-- DomainLogBroadcastSeverity Warning
-r-- DomainLogBroadcasterBufferSize 0
-r-- FileCount 7
-r-- FileMinSize 500
-r-- FileName myserver.log
-r-- FileTimeSpan 24
-r-- Log4jLoggingEnabled false
-r-- LogFileFilter null
-r-- LogFileRotationDir null
-r-- LogFileSeverity Debug
-r-- MemoryBufferFilter null
-r-- MemoryBufferSeverity Debug
-r-- MemoryBufferSize 500
-r-- Name myserver
-r-- Notes null
-r-- NumberOfFilesLimited false
-r-- RedirectStderrToServerLogEnabled false
-r-- RedirectStdoutToServerLogEnabled false
-r-- RotateLogOnStartup true
-r-- RotationTime 00:00
-r-- RotationType bySize
-r-- StdoutFilter null
-r-- StdoutSeverity Warning
-r-- Type Log
-r-x   isSet                                        Boolean : String(propertyName)
-r-x unSet Void : String(propertyName)

ls コマンドの出力情報において、dcd コマンドを使用できる MBean (ファイル システムのディレクトリに類似) を示し、r は読み取り可能なプロパティを示し、w は書き込み可能なプロパティを示し、x は実行可能なオペレーションを示します。

注意 : この読み取り、書き込み、および実行の各インジケータは、現在のユーザのアクセス権に制限がないことを前提としています。WebLogic セキュリティ レルムのポリシーによって適切な権限が付与されていないユーザは、WLST で読み取り可能と示されている値でも、読み取ることができない場合があります。 (『WebLogic Server MBean リファレンス』の「Default Security Policies for MBeans」を参照)。

親 MBean に戻るには、cd('..') コマンドを入力します。

wls:/mydomain/serverConfig/Servers/myserver/Log/myserver> cmo
[MBeanServerInvocationHandler]mydomain:Name=myserver,Server=myserver,Type=Log
wls:/mydomain/serverConfig/Servers/myserver/Log/myserver> cd('..')
wls:/mydomain/serverConfig/Servers/myserver/Log>
wls:/mydomain/serverConfig/Servers/myserver/Log> cmo
[MBeanServerInvocationHandler]mydomain:Name=myserver,Type=Server

親 MBean タイプに戻った後、WLST は cmoLogMBean から ServerMBean に変更します。

階層の深くにある MBean に移動した後でルート MBean に戻るには、cd('/') コマンドを入力します。

 


実行時 MBean の参照

コンフィグレーション情報と同様に、WebLogic Server 実行時 MBean は階層データ構造として配列されています。管理サーバに接続されているとき、serverRuntime または domainRuntime コマンドを入力して、実行時 MBean 階層にアクセスします。serverRuntime コマンドにより、WLST はサーバの実行時管理オブジェクトのルート ServerRuntimeMBean に置かれ、domainRuntime コマンドは、ドメイン全体の実行時管理オブジェクトのルート DomainRuntimeMBean に置かれます。管理対象サーバに接続されているとき、実行時 MBean のルートは ServerRuntimeMBean です。ドメイン実行時 MBean 階層は、管理サーバ上のみに存在します。管理対象サーバに接続されているときに domainRuntime コマンドは使用できません。

詳細については、『WebLogic Server MBean リファレンス』の「ServerRuntimeMBean」および「DomainRuntimeMBean」を参照してください。

cd コマンドの使用により、WLST は任意の実行時子 MBean に移動できます。実行時 MBean のナビゲーション モデルは、コンフィグレーション MBean のナビゲーション モデルと同じです。ただし、実行時 MBean は基底となる管理対象リソース (管理サーバ上のドメイン全体の実行時 MBean を除く) と同じサーバ インスタンスにのみ存在し、すべて編集不可です。

実行時 MBean サンプルの移動と表示

コード リスト 5-3 のコマンドは、管理サーバのインスタンスに接続してから移動し、サーバおよびドメイン実行時 MBean を表示するよう WLST に指示します。

コード リスト 5-3 実行時 MBean の移動と表示
wls:/(offline) > connect('username','password')
wls:/mydomain/serverConfig> serverRuntime()
Location changed to serverRuntime tree.This is a read-only tree with ServerRuntimeMBean as the root.
For more help, use help('serverRuntime')
wls:/mydomain/serverRuntime> ls()
dr-- ApplicationRuntimes
dr-- ClusterRuntime
dr-- ConnectorServiceRuntime
...
dr-- JDBCServiceRuntime
dr-- JMSRuntime
dr-- JTARuntime
dr-- JVMRuntime
dr-- LibraryRuntimes
dr-- MailSessionRuntimes
dr-- RequestClassRuntimes
dr-- ServerChannelRuntimes
dr-- ServerSecurityRuntime
dr-- ServerServices
dr-- ThreadPoolRuntime
dr-- WLDFAccessRuntime
dr-- WLDFRuntime
dr-- WTCRuntime
dr-- WorkManagerRuntimes

-r-- ActivationTime 1093958848908
-r-- AdminServer true
-r-- AdminServerHost
-r-- AdminServerListenPort 7001
-r-- AdminServerListenPortSecure false
-r-- AdministrationPort 9002
-r-- AdministrationPortEnabled false
...
wls:/mydomain/serverRuntime> domainRuntime()
Location changed to domainRuntime tree.This is a read-only tree with DomainRuntimeMBean as the root.
For more help, use help('domainRuntime')
wls:/mydomain/domainRuntime> ls()
dr-- DeployerRuntime
...
dr-- ServerLifecycleRuntimes
dr-- ServerRuntimes
-r--   ActivationTime                               Tue Aug 31 09:27:22 EDT 2004
-r--   Clusters                                     null
-rw- CurrentClusterDeploymentTarget null
-rw- CurrentClusterDeploymentTimeout 0
-rw- Name mydomain
-rw- Parent null
-r-- Type DomainRuntime
-r-x   lookupServerLifecycleRuntime                 javax.management.ObjectName
: java.lang.String
wls:/mydomain/domainRuntime>

コード リスト 5-4 のコマンドは、管理対象サーバ インスタンス上の実行時 MBean の移動と表示を WLST に指示します。

コード リスト 5-4 管理対象サーバ上の実行時 MBean の移動と表示
wls:/offline> connect('username','password',`t3://localhost:7701')
Connecting to weblogic server instance running at t3://localhost:7701 as username weblogic ...
Successfully connected to managed Server 'managed1' that belongs to domain 'mydomain'.
Warning: An insecure protocol was used to connect to the server.
To ensure on-the-wire security, the SSL port or Admin port should be used instead.
wls:/mydomain/serverConfig> serverRuntime()
wls:/mydomain/serverRuntime> ls()
dr-- ApplicationRuntimes
dr-- ClusterRuntime
...
dr-- JMSRuntime
dr-- JTARuntime
dr-- JVMRuntime
dr-- LibraryRuntimes
dr-- MailSessionRuntimes
dr-- RequestClassRuntimes
dr-- ServerChannelRuntimes
dr-- ServerSecurityRuntime
dr-- ThreadPoolRuntime
dr-- WLDFAccessRuntime
dr-- WLDFRuntime
dr-- WTCRuntime
dr-- WorkManagerRuntimes
-r--   ActivationTime                               1093980388931
-r-- AdminServer false
-r-- AdminServerHost localhost
-r-- AdminServerListenPort 7001
-r-- AdminServerListenPortSecure false
-r-- AdministrationPort 9002
-r-- AdministrationPortEnabled false
...
wls:/mydomain/serverRuntime>

 


MBean 階層間の移動

実行時階層からコンフィグレーション MBean に移動するには、serverConfig または domainConfig (管理サーバのみに接続している場合) コマンドを入力します。これにより、WLST は serverRuntime または domainRuntime コマンドを入力する直前の移動先のコンフィグレーション MBean に置かれます。

次のサンプルのコマンドでは、実行時 MBean 階層からコンフィグレーション MBean 階層に移動し、また戻ってくるよう WLST に指示しています。

wls:/mydomain/serverRuntime/JVMRuntime/managed1> serverConfig()
Location changed to serverConfig tree.This is a read-only tree with DomainMBean as the root.
For more help, use help('serverConfig')
wls:/mydomain/serverConfig> cd ('Servers/managed1')
wls:/mydomain/serverConfig/Servers/managed1> cd('Log/managed1')
wls:/mydomain/serverConfig/Servers/managed1/Log/managed1> serverRuntime()
wls:/mydomain/serverRuntime/JVMRuntime/managed1>

実行時 MBean 階層から再び serverConfig コマンドを入力することで、WLST は直前の移動先のコンフィグレーション MBean に置かれます。

wls:/mydomain/serverRuntime/JVMRuntime/managed1> serverConfig()
wls:/mydomain/serverConfig/Servers/managed1/Log/managed1>

詳細については、「ツリー コマンド」を参照してください。

また、currentTree コマンドを使用して現在の MBean 階層の場所を保存し、そこから別の場所に移動した後、再びそこに戻ることもできます。「currentTree」を参照してください。

次に例を示します。

wls:/mydomain/serverConfig/Servers/managed1/Log/managed1> myLocation = currentTree()
wls:/mydomain/serverConfig/Servers/managed1/Log/managed1> serverRuntime()
wls:/mydomain/serverRuntime> cd(`JVMRuntime/managed1')
wls:/mydomain/serverRuntime/JVMRuntime/managed1>myLocation()
wls:/mydomain/serverConfig/Servers/managed1/Log/managed1>

 


MBean と属性の検索

特定の MBean および属性を探すには、find コマンドを使用します。WLST は、属性およびその値を格納する MBean へのパス名を返します。パスで指定された MBean に戻るには、getMBean コマンドを使用します。詳細については、「find」および「getMBean」を参照してください。

次に例を示します。

wls:/mydomain/edit !> find('logfilename')

searching ...

/ApplicationRuntimes/myserver_wlnav.war/WebAppComponentRuntime/myserver_myserver_wlnav.war_wlnav_/wlnavLogFilename null

/Servers/myserver                          JDBCLogFileName jdbc.log

/Servers/myserver/WebServer/myserver       LogFileName access.log

wls:/mydomain/edit !> bean=getMBean('Servers/myserver/WebServer/myserver')
wls:/mydomain/edit !> print bean
[MBeanServerInvocationHandler]mydomain:Name=myserver,Type=WebServer,Server=myserver
wls:/mydomain/edit !>

注意 : インスタンスが見つからない場合、getMBean は例外を送出しません。

別の方法としては、getPath コマンドが、指定した MBean インスタンスの MBean パス、または現在の MBean 階層内の MBean のための ObjectName を返します。「getPath」を参照してください。

wls:/mydomain/serverConfig>path=getPath('com.bea:Name=myserver,Type=Server')
wls:/mydomain/serverConfig> print path
Servers/myserver

 


BEA のその他の MBean とカスタム MBean へのアクセス

WebLogic Server MBean へのアクセスに加え、WLST では、WebLogic Integration および WebLogic Portal が提供する MBean にアクセスできます。また、ユーザが作成および登録した MBean (カスタム MBean) にアクセスし、独自のリソースをコンフィグレーションまたはモニタできます。独自の MBean の作成および登録については、『JMX による管理の容易なアプリケーションの開発』の「カスタム MBean のインスツルメントと登録」を参照してください。

BEA のその他の MBean またはカスタム MBean を移動するには、WLST が管理サーバまたは管理対象サーバのインスタンスに接続されているときに、custom コマンドを入力します。

WLST では、WebLogic Server 以外の MBean はすべてカスタム MBean として処理されます。

カスタム MBean の移動例は以下のとおりです。

wls:/mydomain/serverConfig> custom()
Location changed to custom tree.This is a writable tree with No root.For more help, use help('custom')
wls:/mydomain/custom> ls()
drw- mycompany
drw- anothercompany
wls:/mydomain/custom> cd("mycompany")
wls:/mydomain/custom/mycompany> ls()
drw- mycompany:y1=x
drw- mycompany:y2=x
wls:/mydomain/custom/mycompany> cd("mycompany:y1=x")
wls:/mydomain/custom/mycompany/mycompany:y1=x> ls()
-rw- MyAttribute      10
wls:/mydomain/custom/mycompany/mycompany:y1=x>

ページの先頭       前  次