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 を使用したリソースアダプターの設定

  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. サーバー リソースアダプターレベル <config-property> を設定します。
    [standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar/config-properties=server/:add(value=localhost)          
    {"outcome" => "success"}
    
  5. ポート リソースアダプターレベル <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. 管理接続ファクトリーレベルの <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"}}
            }}
        }
    }
    

手順22.6 Web ベースの管理コンソールを使用したリソースアダプターの設定

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

手順22.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 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>
    
    
  6. サーバーの起動

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