22 Configuring Resource Adapters

This chapter describes how to configure resource adapters (connectors) in Oracle WebLogic Server Multitenant (MT).

This chapter includes the following sections:

Configuring Resource Adapters in a Domain Partition: Overview

Oracle WebLogic Server Multitenant allows standalone and embedded resource adapters to be deployed in a domain partition through resource groups and resource group templates. For more information about deploying applications, see Deploying Applications.

When a resource adapter is deployed in a partition, all of its resources such as the resource adapter beans, connection pools, and administered objects are registered in the JNDI namespace of the partition, and their JNDI names and class loaders are isolated from other partition's applications. Therefore, only those applications in the same partition can access the services provided by the resource adapter and only those applications in the same partition can access the classes of resource adapter.

When a resource adapter is deployed in a domain, all of its resource adapter beans, connection pools, and administered objects are registered in the domain's JNDI namespace. These resources are only visible to applications deployed in the domain.

Example config.xml for Domain-Level Resource Adapter

You can configure a resource adapter in a resource group template and then reference it by the resource group of a partition.

In this example, a standalone resource adapter is defined in a resource group template. Each of the two partitions, HR and Finance, defines a resource group that inherits the applications and resources from the resource group template. In this case, each partition has its own resource adapter.

Example 22-1 Example config.xml for Domain-Level Connector

<domain>
...
<resource-group-template>
      <name>RGT1</name>
      <app-deployment>
         <name>my_ra</name>
         <module-type>rar</module-type>
         <source-path>/some/directory/mail-connector.rar</source-path>
         <deployment-order>120</ deployment-order >
         ...
      </app-deployment>
      ...
   </resource-resource-template>
 
   <partition>
       <name>HR</name>
       <resource-group>
          <name>RG1</name>
          <resource-group-template>RGT1</resource-group-template>
       </resource-group>
       ...
   </partition>
   <partition>
       <name>Finance</name>
       <resource-group>
          <name>RG2</name>
          <resource-group-template>RGT1/resource-group-template>
       </resource-group>
       ...
   </partition>
...
</domain>

Example config.xml for Partition-Level Resource Adapter

In this example, there are two partitions, HR and Finance, defined in the domain. The HR partition has a resource group that defines a standalone resource adapter. In this case, the resource adapter deployed in the HR partition is invisible to the Finance partition.

Example 22-2 Example config.xml for Partition-Level Connector

<domain>
...
<partition>
      <name>HR</name>
      <resource-group>
          <name>HR Apps and Resources</name>
          <app-deployment>
             <name>mailra</name>
             <module-type>rar</module-type>
             <source-path>/some/directory/mail-connector.rar</source-path>
             <deployment-order>120</ deployment-order >
             ...
          </app-deployment>
          ...
 
      </resource-group>
   </partition>
 
   <partition>
      <name>Finance</name>
      ...
   </partition>
...
</domain>

Best Practices and Considerations When Using Resource Adapters in a Domain Partition

This section describes best practices and considerations for system administrators developing resource adapters for a multitenant environment.

Defining the Classloading Behavior for Partition-Level Resource Adapters

Partition-level standalone resource adapter will be loaded by the partition class loader, which is a sub class loader of domain /lib class loader, and the parent of all application class loaders for a partition.

The <enable-global-access-to-classes> element in the weblogic-ra.xml deployment descriptor determines the classloading behavior of resource adapter classes in a partition.

For more information, see "weblogic-ra.xml Schema" in Developing Resource Adapters for Oracle WebLogic Server.

  • If <enable-global-access-to-classes> is set to false, the classloading behavior of the partition resource adapter classes will be same as the domain-level resource adapter classes.

  • If <enable-global-access-to-classes> is set to true:

    • When the resource adapter is deployed to a domain, the resource adapter classes will be loaded by the domain class loader. Therefore, the resource adapter classes are isolated from applications in other partitions.

    • When the resource adapter is deployed to a partition, the resource adapter classes will be loaded by the partition class loader. Therefore, the resource adapter classes are isolated from applications in domain partition and other partitions.

Overriding Application Configuration for a Partition

Each partition can specify a deployment plan which can be used to override the configuration defined in the resource group template. The resource adapter application should apply this deployment plan during deployment.

For more information, see Overriding Application Configuration.

A deployment plan file can be specified at the application level via the plan-path attribute of the AppDeploymentConfigMBean to override resource adapter's configuration. When a resource group of a partition references a resource adapter of a resource group template, it can override the resource group configuration via macro substitution for the specified deployment plan at the application level.The following example shows a resource group template with a macro for the deployment plan file name. There are two partitions, HR and Finance.

<domain>
    <resource-group-template>
        <name>RGT1</name>
        <app-deployment>
            <name>mailra</name>
                 <name>my_ra</name>
                 <module-type>rar</module-type>
                 <source-path>/some/directory/sample_connector.rar</source-path>
                 <deployment-order>120</ deployment-order >
            <plan-path>${MYRA-PLAN-FILE}</plan-path>
        </app-deployment>
        ...
    </resource-group-template>
 
    <partition>
        <name>HR</name>
        <resource-group>
            <name>RG1</name>
            <resource-group-template>RGT1</resource-group-template>
        </resource-group>
        <partition-properties>
            <partition-property>
                <name>MYRA-PLAN-FILE</name>
                <value>/apps/plans/hr/my_ra-plan.xml</value>
            </partition-property>
        </partition-properties>
        ...
    </partition>
 
    <partition>
        <name>Finance</name>
        <resource-group>
            <name>RG2</name>
            <resource-group-template>RGT1</resource-group-template>
        </resource-group>
        <partition-properties>
            <partition-property>
                <name>MYRA-PLAN-FILE</name>
                <value>/apps/plans/Finance/my_ra-plan.xml</value>
            </partition-property>
        </partition-properties>
        ...
    </partition>
</domain>

Considerations for Resource Adapter Resource Definitions

You can use the @ConnectorResourceDefinition and @AdministeredObjectDefinition annotations for defining resource adapter resources in your web module, EJB module, or equivalent application deployment descriptor. When you use these annotations, the following conditions apply in a multitenant environment:

  • If @ConnectorResourceDefinition and @AdministeredObjectDefinition or equivalent deployment descriptor are defined in the domain-level application, its related resource adapter should be deployed at the domain level.

  • If @ConnectorResourceDefinition and @AdministeredObjectDefinition or equivalent deployment descriptor are defined in the partition-level application, its related resource adapter should be deployed in the same partition.

Resource Group Migration and Resource Adapters

A standalone resource adapter is shared across resource groups in the same partition. It can be defined in a resource group, but it is not occupied exclusively by that resource group. Suppose resource group RG1 depends on a standalone resource adapter RA2 which is defined in resource group RG2, if RG2 is migrated to new cluster, then RG1 has to be migrated to that cluster at the same time. Otherwise RG1 will not work.

Oracle recommends that you define a resource adapter and all related applications in the same resource group if you want to do resource group migration.