Red Hat Training
A Red Hat training course is available for Red Hat JBoss Enterprise Application Platform
22.4. デプロイされたリソースアダプターの設定
JBoss 管理者は、管理 CLI ツールまたは Web ベースの管理コンソールを使用して JBoss EAP 6 のリソースアダプターを設定できます。また、設定ファイルを手作業で編集して設定することも可能です。
サポートされるプロパティーと他の詳細については、リソースアダプターのベンダードキュメントを参照してください。
注記
以下の手順では、
[standalone@localhost:9999 /]
プロンプトに従ってコマンドラインを入力する必要があります。テキストを中括弧内に入力しないでください。これは、{"outcome" => "success"} のようにコマンドの結果として表示さ
れる出力です。
手順22.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"}
サーバー
リソースアダプターレベル <config-property> を設定します。[standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar/config-properties=server/:add(value=localhost) {"outcome" => "success"}
ポート
リソースアダプターレベル <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"}
- 管理接続ファクトリーレベルの <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"}} }} } }
手順22.6 Web ベースの管理コンソールを使用したリソースアダプターの設定
- 管理コンソールへログインします。「管理コンソールへのログイン」を参照してください。
- 画面上部の Configuration タブをクリックします。Connectors メニューを展開し、Resource Adapters を選択します。
- ドメインモードでは、左上のドロップダウンから プロファイル を選択します。
Add をクリックします。 - アーカイブ名を入力し、TX: ドロップダウンメニューからトランザクションタイプ
XATransaction
を選択します。次に、Save をクリックします。 - Properties タブを選択します。Add をクリックします。
- 値 に
server
を、Name およびホスト名(例:localhost
)を入力し ます。次に、Save をクリックして終了します。 - もう一度 追加 をクリックします。値 の name および
ポート
番号(例:9000
)に port を入力し ます。次に、Save をクリックして終了します。 サーバー
およびポート
プロパティーが Properties パネルに表示されるようになりました。一覧表示されたリソースアダプターの Option 列にある View リンクをクリックして、Connection Definitions を表示します。- 利用可能な接続 定義の表の上にある Add をクリックして、接続定義を追加します。
- JNDI Name および Connection Class の完全修飾クラス名を入力します。次に、Save をクリックして終了します。
- 新しい Connection Definition を選択し、Properties タブを選択します。Add をクリックして、このコネクション定義の Key および Value データを入力します。Save をクリックして終了します。
- 接続定義が完了しましたが、無効になっています。接続定義を選択し、Enable をクリックして接続定義を有効にします。
- JNDI 名の場合は、
実際のダイアログで接続定義を変更しますか?
" for the JNDI name.Confirm をクリックします。接続定義がEnabled
と表示されるはずです。 - ページ上部の Admin Objects タブをクリックして、管理オブジェクトを作成および設定します。次に、Add をクリックします。
- 管理オブジェクトの JNDI Name および完全修飾 Class Name を入力します。次に、Save をクリックします。
- Properties タブを選択してから Add をクリックして管理オブジェクトプロパティーを追加します。
- Name フィールドに
しきい値
などの管理オブジェクト設定プロパティーを 入力 します。Value フィールドに設定プロパティーの値を入力します(例:10
)。次に、Save をクリックしてプロパティーを保存します。 - admin オブジェクトが完了し、無効になっています。Enable をクリックして admin オブジェクトを有効にします。
- JNDI 名の
「Admin Ojbect?
」というダイアログが出されます。Confirm をクリックします。admin オブジェクトはEnabled
と表示されるはずです。 - このプロセスを完了するには、サーバー設定をリロードする必要があります。Runtime タブをクリックします。Server メニューを展開します。左側のナビゲーションパネルで Overview を選択します。
- サーバーをリロードします。
- ドメインモードでは、サーバーグループにマウスを合わせます。Restart Group を選択します。
- スタンドアロンモードでは、リロード ボタンを 使用できます。Reload をクリックします。
- 指定のサーバーに対して、
Do you want to reload the server configuration?
というダイアログが表示されます。Confirm をクリックします。サーバー設定が最新の状態である。
手順22.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 id="NAME"> <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 サーバーを再起動します。