17.4. Configure a Deployed Resource Adapter

JBoss administrators can configure resource adapters for JBoss Enterprise Application Platform 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.

Procedure 17.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
      $ Connected to standalone controller at localhost:9999
      
    • For Windows, enter the following at a command line:
      C:\>EAP_HOME\bin\jboss-cli.bat --connect
      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 17.6. Configure a resource adapter using the Web-based Management Console

  1. Start your JBoss Enterprise Application Platform 6 server.
  2. If you have not yet added a management user, add one now. For more information, refer to the Getting Started chapter of the Installation guide for JBoss Enterprise Application Platform 6.
  3. Open a web browser and navigate to the Management Console. The default location is http://localhost:9990/console/. For more information about the Management Console, see Section 3.2.2, “Log in to the Management Console”.
  4. Click on the Profile link on the top right to switch to the Profile view. Choose Resource Adapters in the left navigation panel, then click Add at the top right.
    JCA Resource Adapters

    Figure 17.10. JCA Resource Adapters


  5. Enter the archive name and choose transaction type XATransaction from the TX: drop-down box. Then click Save.
    Create Resource Adapter

    Figure 17.11. Create Resource Adapter


  6. Select the Properties tab, then click Add to add resource adapter properties.
    Add Resource Adapter Properties

    Figure 17.12. Add Resource Adapter Properties


  7. Enter server for the Name and the host name, for example localhost, for the Value. Then click Save to save the property.
    Add Resource Adapter Server Property

    Figure 17.13. Add Resource Adapter Server Property


  8. Enter port for the Name and the port number, for example 9000, for the Value. Then click Save to save the property.
    Add Resource Adapter Port Property

    Figure 17.14. Add Resource Adapter Port Property


  9. 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.
    Resource Adapter Server Properties Complete

    Figure 17.15. Resource Adapter Server Properties Complete


  10. Click Add in the upper right side of the page to add a connection definition.
    Add a Connection Definition

    Figure 17.16. Add a Connection Definition


  11. Enter the JNDI Name and the fully qualified class name of the Connection Class. Then click Next.
    Create Connection Definition Property - Step 1

    Figure 17.17. Create Connection Definition Property - Step 1


  12. Click Add to enter the Key and Value data for this connection definition.
    Create Connection Definition Property - Step 2

    Figure 17.18. Create Connection Definition Property - Step 2


  13. Click in the name field under the Key column to enable data entry for the field. Type the property name and press enter when done. Click in the value field under the Value column to enable data entry for the field. Enter the value for the property and press enter when done. Then click Save to save the property.
    Create Connection Definition Property - Step 2

    Figure 17.19. Create Connection Definition Property - Step 2


  14. The connection definition is complete, but disabled. Click Enable to enable the connection definition.
    Create Connection Definition - Disabled

    Figure 17.20. Create Connection Definition - Disabled


  15. A dialog asks "Really modify Connection Definition?" for the JNDI name. Click Confirm. The connection definition should now appear as Enabled.
    Connection Definition Enabled

    Figure 17.21. Connection Definition Enabled


  16. Click the Admin Objects tab in top middle of the page to create and configure admin objects. Then click Add.
    Available Admin Objects

    Figure 17.22. Available Admin Objects


  17. Enter the JNDI Name and the fully qualified Class Name for the admnin object. Then click Save.
    Create Admin Object

    Figure 17.23. Create Admin Object


  18. Select the Properties tab, then click Add to add admin object properties.
    Add Admin Object Properties

    Figure 17.24. Add Admin Object Properties


  19. 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.
    Create Admin Ojbect Configuration Property

    Figure 17.25. Create Admin Ojbect Configuration Property


  20. The admin object is complete, but disabled. Click Enable to enable the admin object.
    Admin Object - Disabled

    Figure 17.26. Admin Object - Disabled


  21. A dialog asks "Really modify Admin Ojbect?" for the JNDI name. Click Confirm. The admin object should now appear as Enabled.
    Connection Definition Enabled

    Figure 17.27. Connection Definition Enabled


  22. You must reload the server configuration to complete the process. Click on the Runtime link on the top right to switch to the Runtime view, then choose Configuration in the left navigation panel, and click Reload at the right.
    Server Configuration Reload

    Figure 17.28. Server Configuration Reload


  23. A dialog asks "Do you want to reload the server configuration?" for the specified server. Click Confirm. The server configuration is up to date.
    Connection Definition Enabled

    Figure 17.29. Connection Definition Enabled


Procedure 17.7. Configure a resource adapter manually

  1. Stop the JBoss Enterprise Application Platform 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.0"/>
    
    
    with this:
                      
    
    <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">
        <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 Enterprise Application Platform server to start it running with the new configuration.