24.4. Configure a Deployed Resource Adapter

JBoss administrators can configure resource adapters for JBoss EAP 6 using the Management CLI tool, the Web-based Management Console, or by manually editing the configuration the files.
Refer to the vendor document for your resource adapter for information about supported properties and other details.

Note

In the following procedure, the command line you must type follows the [standalone@localhost:9999 /] prompt. Do not type the text within the curly braces. That is the output you should see as a result of the command, for example, {"outcome" => "success"}.

Procedure 24.5. Configure a resource adapter using the Management CLI

  1. Open a command prompt for your operating system.
  2. Connect to the Management CLI.
    • For Linux, enter the following at the command line:
      $ EAP_HOME/bin/jboss-cli.sh --connect
      You should see the following result output:
      $ Connected to standalone controller at localhost:9999
    • For Windows, enter the following at a command line:
      C:\>EAP_HOME\bin\jboss-cli.bat --connect
      You should see the following result output:
      C:\> Connected to standalone controller at localhost:9999
  3. Add the resource adapter configuration.
    [standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar:add(archive=eis.rar, transaction-support=XATransaction) 
    {"outcome" => "success"}
    
  4. Configure the server resource adapter level <config-property>.
    [standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar/config-properties=server/:add(value=localhost)          
    {"outcome" => "success"}
    
  5. Configure the port resource adapter level <config-property>.
    [standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar/config-properties=port/:add(value=9000)
    {"outcome" => "success"}
    
  6. Add a connection definition for a managed connection factory.
    [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. Configure the name managed connection factory level <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. Add an admin object.
    [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. Configure the threshold admin object property.
    [standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar/admin-objects=aoName/config-properties=threshold/:add(value=10)
    {"outcome" => "success"}
    
  10. Activate the resource adapter.
    [standalone@localhost:9999 /] /subsystem=resource-adapters/resource-adapter=eis.rar:activate
    {"outcome" => "success"}
    
  11. View the newly configured and activated resource adapter.
    [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"}}
            }}
        }
    }
    

Procedure 24.6. Configure a resource adapter using the Web-based Management Console

  1. Login to the Management Console. See Section 3.4.2, “Log in to the Management Console”.
  2. Click on the Configuration tab at the top of the screen. Expand the Connectors menu and select Resource Adapters.
    1. In Domain mode, select a Profile from the drop-down at top left.
    Click Add.
  3. Enter the archive name and choose transaction type XATransaction from the TX: drop-down box. Then click Save.
  4. Select the Properties tab. Click Add.
  5. Enter server for the Name and the host name, for example localhost, for the Value. Then click Save to finish.
  6. Click Add again. Enter port for the Name and the port number, for example 9000, for the Value. Then click Save to finish.
  7. The server and port properties now appear in the Properties panel. Click the View link under the Option column for the listed resource adapter to view the Connection Definitions.
  8. Click Add above the Available Connection Definitions table to add a connection definition.
  9. Enter the JNDI Name and the fully qualified class name of the Connection Class. Then click Save to finish.
  10. Select the new Connection Definition, the select the Properties tab. Click Add to enter the Key and Value data for this connection definition. Click Save to finish.
  11. The connection definition is complete, but disabled. Select the connection definition and click Enable to enable the connection definition.
  12. A dialog asks Really modify Connection Definition?" for the JNDI name. Click Confirm. The connection definition should now appear as Enabled.
  13. Click the Admin Objects tab at the top of the page to create and configure admin objects. Then click Add.
  14. Enter the JNDI Name and the fully qualified Class Name for the admin object. Then click Save.
  15. Select the Properties tab, then click Add to add admin object properties.
  16. Enter an admin object configuration property, for example threshold, in the Name field. Enter the configuration property value, for example 10, in the Value field. Then click Save to save the property.
  17. The admin object is complete, but disabled. Click Enable to enable the admin object.
  18. A dialog asks Really modify Admin Ojbect? for the JNDI name. Click Confirm. The admin object should now appear as Enabled.
  19. You must reload the server configuration to complete the process. Click on the Runtime tab. Expand the Server menu. Select Overview in the left navigation panel.
    1. Reload the servers
      • In Domain mode, hover the mouse over a server group. Select Restart Group.
      • In Standalone mode, a Reload button will be available. Click Reload.
  20. A dialog asks Do you want to reload the server configuration? for the specified server. Click Confirm. The server configuration is up to date.

Procedure 24.7. Configure a resource adapter manually

  1. Stop the JBoss EAP 6 server.

    Important

    You must stop the server before editing the server configuration file for your change to be persisted on server restart.
  2. Open the server configuration file for editing.
    • For a standalone server, this is the EAP_HOME/standalone/configuration/standalone.xml file.
    • For a managed domain, this is the EAP_HOME/domain/configuration/domain.xml file.
  3. Find the urn:jboss:domain:resource-adapters subsystem in the configuration file.
  4. If there are no resource adapters defined for this subsystem, first replace:
    
    <subsystem xmlns="urn:jboss:domain:resource-adapters:1.1"/>
    
    
    with this:
                      
    
    <subsystem xmlns="urn:jboss:domain:resource-adapters:1.1">
        <resource-adapters>
            <!-- <resource-adapter> configuration listed below -->
        </resource-adapters>
    </subsystem>
    
    
  5. Replace the <!-- <resource-adapter> configuration listed below --> with the XML definition for your resource adapter. The following is the XML representation of the resource adapter configuration created using the Management CLI and Web-based Management Console described above.
    
    <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. Start the server

    Relaunch the JBoss EAP 6 server to start it running with the new configuration.