24.4. デプロイされたリソースアダプターの設定
JBoss 管理者は、管理 CLI ツールまたは Web ベースの管理コンソールを使用して JBoss EAP 6 のリソースアダプターを設定できます。また、設定ファイルを手作業で編集して設定することも可能です。
サポートされるプロパティーと他の詳細については、リソースアダプターのベンダードキュメントを参照してください。
注記
次の手順では、
[standalone@localhost:9999 /]
プロンプトの後にコマンドラインを入力する必要があります。波括弧の間にテキストを入力しないでください。コマンドを入力すると、{"outcome" => "success"}
(出力例) のような出力が生成されます。
手順24.5 管理 CLI を使用したリソースアダプターの設定
- オペレーティングシステムのコマンドプロンプトを開きます。
- 管理 CLI へ接続します。
- Linux の場合は、コマンドラインで以下を入力します。
$ EAP_HOME/bin/jboss-cli.sh --connect
次のような出力が表示されるはずです。$ Connected to standalone controller at localhost:9999
- Windows の場合は、コマンドラインで以下を入力します。
C:\>EAP_HOME\bin\jboss-cli.bat --connect
次のような出力が表示されるはずです。C:\> Connected to standalone controller at localhost:9999
- リソースアダプター設定を追加します。
[standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar:add(archive=eis.rar, transaction-support=XATransaction) {"outcome" => "success"}
server
リソースアダプターレベル <config-property> を設定します。[standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar/config-properties=server/:add(value=localhost) {"outcome" => "success"}
port
リソースアダプターレベル <config-property> を設定します。[standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar/config-properties=port/:add(value=9000) {"outcome" => "success"}
- 管理接続ファクトリーの接続定義を追加します。
[standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar/connection-definitions=cfName:add(class-name=com.acme.eis.ra.EISManagedConnectionFactory, jndi-name=java:/eis/AcmeConnectionFactory) {"outcome" => "success"}
name
管理対象接続ファクトリーレベル <config-property> を設定します。[standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar/connection-definitions=cfName/config-properties=name/:add(value=Acme Inc) {"outcome" => "success"}
- 管理オブジェクトを追加します。
[standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar/admin-objects=aoName:add(class-name=com.acme.eis.ra.EISAdminObjectImpl, jndi-name=java:/eis/AcmeAdminObject) {"outcome" => "success"}
threshold
管理オブジェクトプロパティーを設定します。[standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar/admin-objects=aoName/config-properties=threshold/:add(value=10) {"outcome" => "success"}
- リソースアダプターをアクティベートします。
[standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar:activate {"outcome" => "success"}
- 新しく設定されアクティベートされたリソースアダプターを表示します。
[standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar:read-resource(recursive=true) { "outcome" => "success", "result" => { "archive" => "eis.rar", "beanvalidationgroups" => undefined, "bootstrap-context" => undefined, "transaction-support" => "XATransaction", "admin-objects" => {"aoName" => { "class-name" => "com.acme.eis.ra.EISAdminObjectImpl", "enabled" => true, "jndi-name" => "java:/eis/AcmeAdminObject", "use-java-context" => true, "config-properties" => {"threshold" => {"value" => 10}} }}, "config-properties" => { "server" => {"value" => "localhost"}, "port" => {"value" => 9000} }, "connection-definitions" => {"cfName" => { "allocation-retry" => undefined, "allocation-retry-wait-millis" => undefined, "background-validation" => false, "background-validation-millis" => undefined, "blocking-timeout-wait-millis" => undefined, "class-name" => "com.acme.eis.ra.EISManagedConnectionFactory", "enabled" => true, "flush-strategy" => "FailingConnectionOnly", "idle-timeout-minutes" => undefined, "interleaving" => false, "jndi-name" => "java:/eis/AcmeConnectionFactory", "max-pool-size" => 20, "min-pool-size" => 0, "no-recovery" => undefined, "no-tx-separate-pool" => false, "pad-xid" => false, "pool-prefill" => false, "pool-use-strict-min" => false, "recovery-password" => undefined, "recovery-plugin-class-name" => undefined, "recovery-plugin-properties" => undefined, "recovery-security-domain" => undefined, "recovery-username" => undefined, "same-rm-override" => undefined, "security-application" => undefined, "security-domain" => undefined, "security-domain-and-application" => undefined, "use-ccm" => true, "use-fast-fail" => false, "use-java-context" => true, "use-try-lock" => undefined, "wrap-xa-resource" => true, "xa-resource-timeout" => undefined, "config-properties" => {"name" => {"value" => "Acme Inc"}} }} } }
手順24.6 Web ベースの管理コンソールを使用したリソースアダプターの設定
- 管理コンソールにログインします。「管理コンソールへのログイン」 を参照してください。
- 画面上部にある Configuration タブをクリックします。Connectors メニューを展開し、Resource Adapters を選択します。
- ドメインモードでは、左上のドロップダウンメニューから Profile を選択します。
追加 をクリックします。 - アーカイブ名を入力し、TX: ドロップダウンボックスよりトランザクションタイプ
XATransaction
を選択した後、Save をクリックします。 - Properties タブを選択します。Add をクリックします。
- Name に
server
を入力し、Value にホスト名 (例:localhost
) を入力します。Save をクリックして終了します。 - Add を再度クリックします。Name に
port
を入力し、Value にポート番号 (例:9000
) を入力します。Save をクリックして終了します。 - この時点で
server
およびport
プロパティーが Properties パネルに表示されます。一覧表示されたリソースアダプターの Option カラム下にある View リンクをクリックし、Connection Definitions を表示します。 - Available Connection Definitions の表の上にある Add をクリックし、接続定義を追加します。
- JNDI Name と Connection Class の完全修飾クラス名を入力します。Save をクリックして終了します。
- 新しい接続定義を選択し、Properties タブを選択します。Add をクリックし、この接続定義の Key および Value データを入力します。Save をクリックして終了します。
- これで接続の定義は終わりましたが、無効の状態になっています。接続定義を選択し、Enable をクリックして接続定義を有効にします。
- JNDI 名に対し、
Really modify Connection Definition?
(本当に接続定義を編集しますか) という内容のダイアログが表示されます。Confirm をクリックします。この時点で 接続定義の状態がEnabled
と表示されるはずです。 - ページ上部にある Admin Objects をクリックし、管理オブジェクトを作成および設定します。その後、Add をクリックします。
- 管理オブジェクトの JNDI Name と完全修飾 Class Name を入力します。入力後、Save をクリックします。
- Properties タブを選択した後、Add をクリックして管理オブジェクトプロパティーを追加します。
- Name フィールドに管理オブジェクト設定プロパティー (例:
threshold
) を入力します。Value フィールドに設定プロパティー値 (例:10
) を入力します。すべて入力後、Save をクリックしてプロパティーを保存します。 - これで管理オブジェクトは完了しましたが、無効の状態になっています。Enable をクリックして管理オブジェクトを有効にします。
- JNDI 名に対し
Really modify Admin Object?
(本当に管理オブジェクトを編集しますか) という内容のダイアログが表示されます。Confirm をクリックします。この時点で管理オブジェクトの状態がEnabled
と表示されるはずです。 - この処理を完了するにはサーバー設定をリロードする必要があります。Runtime タブをクリックします。Server メニューを展開し、左側のナビゲーションパネルにある Overview を選択します。
- サーバーをリロードします。
- ドメインモードでは、サーバーグループにマウスオーバーします。Restart Group を選択します。
- スタンドアロンモードでは Reload ボタンを使用できます。Reload をクリックします。
- 指定のサーバーに対し
Do you want to reload the server configuration?
(サーバー設定をリロードしますか) という内容のダイアログが表示されます。Confirm をクリックします。これでサーバー設定が最新の状態になります。
手順24.7 手作業によるリソースサーバーの設定
- JBoss EAP 6 サーバーを停止します。
重要
サーバーの再起動後に変更が維持されるようにするには、サーバーを停止してからサーバー設定ファイルを編集する必要があります。 - 編集するため、サーバー設定ファイルを開きます。
- スタンドアロンサーバーの場合は
EAP_HOME/standalone/configuration/standalone.xml
ファイルになります。 - 管理対象ドメインの場合は
EAP_HOME/domain/configuration/domain.xml
ファイルになります。
- 設定ファイルで
urn:jboss:domain:resource-adapters
サブシステムを探します。 - このサブシステムに対して定義されているリソースアダプターがない場合、最初に以下を置き換えます。
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.1"/>
以下のように置き換えます。<subsystem xmlns="urn:jboss:domain:resource-adapters:1.1"> <resource-adapters> <!-- <resource-adapter> configuration listed below --> </resource-adapters> </subsystem>
<!-- <resource-adapter> configuration listed below -->
をリソースアダプターの XML 定義に置き換えます。前述の管理 CLI および Web ベース管理コンソールを使用して作成されたリソースアダプター設定の XML は次のとおりです。<resource-adapter> <archive> eis.rar </archive> <transaction-support>XATransaction</transaction-support> <config-property name="server"> localhost </config-property> <config-property name="port"> 9000 </config-property> <connection-definitions> <connection-definition class-name="com.acme.eis.ra.EISManagedConnectionFactory" jndi-name="java:/eis/AcmeConnectionFactory" pool-name="java:/eis/AcmeConnectionFactory"> <config-property name="name"> Acme Inc </config-property> </connection-definition> </connection-definitions> <admin-objects> <admin-object class-name="com.acme.eis.ra.EISAdminObjectImpl" jndi-name="java:/eis/AcmeAdminObject" pool-name="java:/eis/AcmeAdminObject"> <config-property name="threshold"> 10 </config-property> </admin-object> </admin-objects> </resource-adapter>
サーバーの起動
新しい設定で実行されるよう JBoss EAP 6 サーバーを再起動します。