Configuring resource adapters
You can configure resource adapters that comply with the Java™ EE Connector Architecture (JCA) specification versions 1.6, 1.5, or 1.0.
About this task
You can install and configure a resource adapter and the various connection factories, administered objects, and activation specifications as defined in the JCA specification.
Procedure
Example
A unique identifier for a resource adapter is necessary to identify configured instances of connection factories, administered objects, and activation specifications as being associated with an installed resource adapter. For stand-alone resource adapters, the module name is used as the identifier. For resource adapters embedded in applications, the combination of the application name plus the module name (delimited by the period character) are used as the identifier.
-
To specify properties for a stand-alone resource adapter using a
properties.MyAdapter
subelement that includes the resource adapter identifier, MyAdapter:<resourceAdapter location="C:/adapters/MyAdapter.rar"> <properties.MyAdapter logFile="${server.output.dir}/logs/myAdapter.log"/> </resourceAdapter>
-
To associate a connection factory with a stand-alone resource adapter using a
properties.MyAdapter
subelement that includes the resource adapter identifier, MyAdapter:<resourceAdapter location="C:/adapters/MyAdapter.rar"/> <connectionFactory jndiName="eis/cf"> <properties.MyAdapter serverName="localhost" portNumber="1234"/> </connectionFactory>
-
To associate a connection factory with a resource adapter MyEmbeddedAdapter, which is enabled in the
app1
application, using aproperties.app1.MyEmbeddedAdapter
subelement:<application location="C:/applications/app1.ear"/> <connectionFactory jndiName="eis/cf"> <properties.app1.MyEmbeddedAdapter serverName="localhost" portNumber="1234"/> </connectionFactory>
-
In some cases, the module name is not sufficiently unique to serve as the identifier. This might happen, for example, if you install two different versions of the same resource adapter. Alternately, the module name might be unique, but undesirable for use in configuration because it is lengthy or contains non-alphanumeric characters. You can override the resource adapter identifier by specifying the id attribute.
The following example demonstrates how to override the identifier for stand-alone resource adapters:
<resourceAdapter id="MyAdapterV1" location="C:/adapters/version-1.0/MyAdapter.rar"/> <resourceAdapter id="MyAdapterV2" location="C:/adapters/version-2.0/MyAdapter.rar"/> <connectionFactory jndiName="eis/cf1"> <properties.MyAdapterV1 serverName="localhost" portNumber="1234"/> </connectionFactory> <connectionFactory jndiName="eis/cf2"> <properties.MyAdapterV2 serverName="localhost" portNumber="1234"/> </connectionFactory>
-
The following example demonstrates how to override the identifier for a resource adapter that is embedded in an application. The example changes the identifier to MyEmbeddedRA:
<application location="C:/applications/app1.ear"> <resourceAdapter id="MyEmbeddedAdapter" alias="MyEmbeddedRA"/> </application> <connectionFactory jndiName="eis/cf"> <properties.app1.MyEmbeddedRA serverName="localhost" portNumber="1234"/> </connectionFactory>
-
To compute the module name for embedded resource adapters, the
<module-name>
entry in the resource adapter deployment descriptor (ra.xml) takes precedence as the module name. For example, given the following definition in ra.xml:<connector ...> <module-name>MyRARModule</module-name> </connector>
the module name would be set to "MyRARModule".
If the module name is absent from the connector deployment descriptor, the short form of the URI referring to the resource adapter module in the application deployment descriptor (application.xml) is used. For example, given the following module definition in application.xml:
<module> <connector>connectors/MyRARModule.rar</connector> </module>
the module name would be computed as "MyRARModule".
If multiple resource adapters are embedded in an application and define the same
<module-name>
value, the first one listed in application.xml uses that module name. The module names of the other connectors with that same conflicting name are calculated from the full form of the URI with all / (forward slash) characters converted to a period (.). For example, if two connectors were embedded in an application both containing the following definition in ra.xml:<connector ...> <module-name>MyRARModule</module-name> </connector>
and the following definitions in application.xml:
<module> <connector>subfolder1/connector1.rar</connector> </module> <module> <connector>subfolder2/connector2.rar</connector> </module>
The module name for the first connector would be "MyRARModule" and the module name for the second would be "subfolder2.connector2.rar"