24.4. デプロイされたリソースアダプターの設定

JBoss 管理者は、管理 CLI ツールまたは Web ベースの管理コンソールを使用して JBoss EAP 6 のリソースアダプターを設定できます。また、設定ファイルを手作業で編集して設定することも可能です。
サポートされるプロパティーと他の詳細については、リソースアダプターのベンダードキュメントを参照してください。

注記

次の手順では、[standalone@localhost:9999 /] プロンプトの後にコマンドラインを入力する必要があります。波括弧の間にテキストを入力しないでください。コマンドを入力すると、{"outcome" => "success"} (出力例) のような出力が生成されます。

手順24.5 管理 CLI を使用したリソースアダプターの設定

  1. オペレーティングシステムのコマンドプロンプトを開きます。
  2. 管理 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
  3. リソースアダプター設定を追加します。
    [standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar:add(archive=eis.rar, transaction-support=XATransaction) 
    {"outcome" => "success"}
  4. server リソースアダプターレベル <config-property> を設定します。
    [standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar/config-properties=server/:add(value=localhost)          
    {"outcome" => "success"}
  5. port リソースアダプターレベル <config-property> を設定します。
    [standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar/config-properties=port/:add(value=9000)
    {"outcome" => "success"}
  6. 管理接続ファクトリーの接続定義を追加します。
    [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"}
  7. 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"}
  8. 管理オブジェクトを追加します。
    [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"}
  9. threshold 管理オブジェクトプロパティーを設定します。
    [standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar/admin-objects=aoName/config-properties=threshold/:add(value=10)
    {"outcome" => "success"}
  10. リソースアダプターをアクティベートします。
    [standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar:activate
    {"outcome" => "success"}
  11. 新しく設定されアクティベートされたリソースアダプターを表示します。
    [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 ベースの管理コンソールを使用したリソースアダプターの設定

  1. 管理コンソールにログインします。「管理コンソールへのログイン」 を参照してください。
  2. 画面上部にある Configuration タブをクリックします。Connectors メニューを展開し、Resource Adapters を選択します。
    1. ドメインモードでは、左上のドロップダウンメニューから Profile を選択します。
    追加 をクリックします。
  3. アーカイブ名を入力し、TX: ドロップダウンボックスよりトランザクションタイプ XATransaction を選択した後、Save をクリックします。
  4. Properties タブを選択します。Add をクリックします。
  5. Nameserver を入力し、Value にホスト名 (例: localhost) を入力します。Save をクリックして終了します。
  6. Add を再度クリックします。Nameport を入力し、Value にポート番号 (例: 9000) を入力します。Save をクリックして終了します。
  7. この時点で server および port プロパティーが Properties パネルに表示されます。一覧表示されたリソースアダプターの Option カラム下にある View リンクをクリックし、Connection Definitions を表示します。
  8. Available Connection Definitions の表の上にある Add をクリックし、接続定義を追加します。
  9. JNDI NameConnection Class の完全修飾クラス名を入力します。Save をクリックして終了します。
  10. 新しい接続定義を選択し、Properties タブを選択します。Add をクリックし、この接続定義の Key および Value データを入力します。Save をクリックして終了します。
  11. これで接続の定義は終わりましたが、無効の状態になっています。接続定義を選択し、Enable をクリックして接続定義を有効にします。
  12. JNDI 名に対し、Really modify Connection Definition? (本当に接続定義を編集しますか) という内容のダイアログが表示されます。Confirm をクリックします。この時点で 接続定義の状態が Enabled と表示されるはずです。
  13. ページ上部にある Admin Objects をクリックし、管理オブジェクトを作成および設定します。その後、Add をクリックします。
  14. 管理オブジェクトの JNDI Name と完全修飾 Class Name を入力します。入力後、Save をクリックします。
  15. Properties タブを選択した後、Add をクリックして管理オブジェクトプロパティーを追加します。
  16. Name フィールドに管理オブジェクト設定プロパティー (例: threshold) を入力します。Value フィールドに設定プロパティー値 (例: 10) を入力します。すべて入力後、Save をクリックしてプロパティーを保存します。
  17. これで管理オブジェクトは完了しましたが、無効の状態になっています。Enable をクリックして管理オブジェクトを有効にします。
  18. JNDI 名に対し Really modify Admin Object? (本当に管理オブジェクトを編集しますか) という内容のダイアログが表示されます。Confirm をクリックします。この時点で管理オブジェクトの状態が Enabled と表示されるはずです。
  19. この処理を完了するにはサーバー設定をリロードする必要があります。Runtime タブをクリックします。Server メニューを展開し、左側のナビゲーションパネルにある Overview を選択します。
    1. サーバーをリロードします。
      • ドメインモードでは、サーバーグループにマウスオーバーします。Restart Group を選択します。
      • スタンドアロンモードでは Reload ボタンを使用できます。Reload をクリックします。
  20. 指定のサーバーに対し Do you want to reload the server configuration? (サーバー設定をリロードしますか) という内容のダイアログが表示されます。Confirm をクリックします。これでサーバー設定が最新の状態になります。

手順24.7 手作業によるリソースサーバーの設定

  1. JBoss EAP 6 サーバーを停止します。

    重要

    サーバーの再起動後に変更が維持されるようにするには、サーバーを停止してからサーバー設定ファイルを編集する必要があります。
  2. 編集するため、サーバー設定ファイルを開きます。
    • スタンドアロンサーバーの場合は EAP_HOME/standalone/configuration/standalone.xml ファイルになります。
    • 管理対象ドメインの場合は EAP_HOME/domain/configuration/domain.xml ファイルになります。
  3. 設定ファイルで urn:jboss:domain:resource-adapters サブシステムを探します。
  4. このサブシステムに対して定義されているリソースアダプターがない場合、最初に以下を置き換えます。
    
    <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>
    
  5. <!-- <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>
    
  6. サーバーの起動

    新しい設定で実行されるよう JBoss EAP 6 サーバーを再起動します。