Skip navigation.

Programming WebLogic Server J2EE Connectors

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents Index View as PDF   Get Adobe Reader


The following sections outline configuration requirements for the WebLogic J2EE Connector Architecture implementation:


Resource Adapter Developer Tools

BEA provides several tools you can use to help you create and configure resource adapters. These tools are described in this section.

ANT Tasks to Create Skeleton Deployment Descriptors

You can use the WebLogic ANT utilities to create skeleton deployment descriptors. These utilities are Java classes shipped with your WebLogic Server distribution. The ANT task looks at a directory containing a resource adapter creates deployment descriptors based on the files it finds in the resource adapter. Because the ANT utility does not have information about all of the desired configurations and mappings for your resource adapter, the skeleton deployment descriptors the utility creates are incomplete. After the utility creates the skeleton deployment descriptors, you can use a text editor, an XML editor, or the Administration Console to edit the deployment descriptors and complete the configuration of your resource adapter.

For more information on using ANT utilities to create deployment descriptors, see Creating WebLogic Server Applications in Developing WebLogic Server Applications.

WebLogic Builder

WebLogic Builder is a visual environment for editing an application's deployment descriptor XML files. You can view descriptor files while you visually edit them in WebLogic Builder, and you won't need to make textual edits to the XML files. For more information, see the WebLogic Builder Online Help.

XML Editors

You can use an XML Editor with DTD validation, such as BEA XML Editor on dev2dev or XMLSpy. (An evaluation copy of XMLSpy is bundled with this version of WebLogic Server.) See BEA dev2dev Online


Configuring Resource Adapters

This section introduces and discusses how to configure the resource adapter for deployment to WebLogic Server.

Resource Adapter Overview

The J2EE Connector Architecture enables both Enterprise Information System (EIS) vendors and third-party application developers to develop resource adapters that can be deployed in any application server supporting the Sun Microsystems J2EE Platform Specification, Version 1.3.

The resource adapter is the central piece of the WebLogic J2EE Connector Architecture; it serves as the J2EE connector between the client component and the EIS. When a resource adapter is deployed in the WebLogic Server environment, it enables the development of robust J2EE Platform applications that can access remote EIS systems. Resource adapters contain the Java components, and if necessary, the native components required to interact with the EIS.

For more information on creating resource adapters, see the Sun Microsystems J2EE Connector Architecture page and the J2EE Connector Specification, Version 1.0 Final Release. These can be found on the Sun Microsystems Web site at the following respective URLs:

Creating and Modifying Resource Adapters: Main Steps

Creating a resource adapter requires creating the classes for the particular resource adapter (ConnectionFactory, Connection, and so on) and the connector-specific deployment descriptors, and then packaging everything up into an jar file to be deployed to WebLogic Server.

Creating a New Resource Adapter Archive (RAR)

The following are the main steps for creating a resource adapter archive (RAR):

  1. Write the Java code for the various classes required by resource adapter (ConnectionFactory, Connection, and so on) in accordance with the J2EE Connector Specification, Version 1.0, Final Release (
  2. When implementing a resource adapter, you must specify classes in the ra.xml file. For example:

  3. Compile the Java code using a standard compiler for the interfaces and implementation into class files.
  4. For instructions on compiling, refer to Compiling Java Code in Developing WebLogic Server J2EE Applications.

  5. Create the resource connector-specific deployment descriptors:
  6. For detailed information about creating connector-specific deployment descriptors, refer to weblogic-ra.xml Deployment Descriptor Elements.

  7. Package the Java classes into a Java archive (JAR) file.
  8. The first step in creating a JAR file is to create a connector staging directory anywhere on your hard drive. Place the JAR file in the staging directory and the deployment descriptors in a subdirectory called META-INF.

    Then you create the resource adapter archive by executing a jar command similar to the following in the staging directory:

    jar cvf myRAR.rar * 
  9. Auto-deploy the RAR resource adapter archive file on WebLogic Server for testing purposes.
  10. For detailed information about auto-deploying components and applications, refer to Tools for Deploying in Deploying WebLogic Server Applications.

    While you are testing the resource adapter, you might need to edit the resource adapter deployment descriptors. You can do this manually or use WebLogic Builder.

    For detailed information, refer to WebLogic Builder Online Help. See weblogic-ra.xml Deployment Descriptor Elementsfor detailed information on the elements in these deployment descriptors.

  11. Deploy the RAR resource adapter archive file on WebLogic Server or include it in an enterprise archive (EAR) file to be deployed as part of an enterprise application.
  12. Refer to Deploying WebLogic Server Applications for detailed information about deploying components and applications.

Modifying an Existing Resource Adapter (RAR)

The following is an example of how to take an existing resource adapter (RAR) and modify it for deployment to WebLogic Server. This involves adding the weblogic-ra.xml deployment descriptor and repacking.

  1. Create a temporary directory anywhere on your hard drive to stage the resource adapter:
	mkdir c:/stagedir
  1. Copy the resource adapter that you will deploy into the temporary directory:
	cp blackbox-notx.rar c:/stagedir
  1. Extract the contents of the resource adapter archive:
	cd c:/stagedir
	jar xf blackbox-notx.rar

The staging directory should now contain the following:

Execute these commands to see these files:

	c:/stagedir> ls
	c:/stagedir> ls META-INF
  1. Create the weblogic-ra.xml file. This file is the WebLogic-specific deployment descriptor for resource adapters. In this file, you specify parameters for connection factories, connection pools, and security mappings.
  2. Refer to weblogic-ra.xml Deployment Descriptor Elements for more information on the weblogic-ra.xml DTD.

  3. Copy the weblogic-ra.xml file into the temporary directory's META-INF subdirectory. The META-INF directory is located in the temporary directory where you extracted the RAR file or in the directory containing a resource adapter in exploded directory format. Use the following command:
	cp weblogic-ra.xml c:/stagedir/META-INF
	c:/stagedir> ls META-INF
  1. Create the resource adapter archive:
	jar cvf blackbox-notx.rar -C c:/stagedir
  1. Deploy the resource adapter to WebLogic Server. For detailed information about deploying components and applications, refer to Tools for Deploying in Deploying WebLogic Server Applications.


Configuring the ra.xml File

If you do not have an ra.xml file, you must manually create or edit an existing one to set the necessary deployment properties for the resource adapter. You can use a text editor to edit the properties. For information on creating an ra.xml file, refer to the J2EE Connector Specification, Version 1.0 Final Release:


Configuring the weblogic-ra.xml File

In addition to supporting features of the standard resource adapter configuration ra.xml file, BEA WebLogic Server defines an additional deployment descriptor file, the weblogic-ra.xml file. This file contains parameters that are specific to configuring and deploying resource adapters in WebLogic Server. This functionality is consistent with the equivalent .xml extensions for EJBs and Web applications in WebLogic Server, which also add WebLogic-specific deployment descriptors to the deployable archive. As is, the basic RAR or deployment directory cannot be deployed to WebLogic Server. You must first create and configure WebLogic Server-specific deployment properties in the weblogic-ra.xml file and add that file to the deployment.

In the weblogic-ra.xml file, you specify the following attributes:

Note: Refer to the weblogic-ra.xml DTD in weblogic-ra.xml Deployment Descriptor Elements, for more information on setting the parameters in weblogic-ra.xml. You can also look at the weblogic-ra.xml file in the included Simple Black Box resource adapter example provided with the product download.

Note: For information on configuring connection properties in a resource adapter, refer to Connection Management.

Automatic Generation of the weblogic-ra.xml File

In WebLogic Server, a resource adapter archive (RAR) must include a weblogic-ra.xml deployment descriptor file in addition to the ra.xml deployment descriptor file specified in the J2EE Connector 1.0 specification. However, if a resource adapter is deployed in WebLogic Server without a weblogic-ra.xml file, a template weblogic-ra.xml file populated with default element values is automatically added to the resource adapter archive. This automatic resource file generation simplifies the process of establishing the parameters necessary to deploy the resource adapter in WebLogic Server.

If your RAR does not contain a weblogic-ra.xml file, WebLogic Server automatically generates this file for you. This feature enables you to deploy third-party resource adapters to WebLogic Server without worrying about modifying them for WebLogic Server. You need only modify two default attribute values that WebLogic Server generates in the weblogic-ra.xml file: <connection-factory-name> and <jndi-name>.

For instructions on how to change these default values, see weblogic-ra.xml Deployment Descriptor Elements.

The following is what the generated weblogic-ra.xml file looks like before you change the default values:

Listing 6-1 weblogic-ra.xml Default Values


Configuring the ra-link-ref Element

The optional <ra-link-ref> element allows you to associate multiple deployed resource adapters with a single deployed resource adapter. In other words, it allows you to link (reuse) resources already configured in a base resource adapter to another resource adapter, modifying only a subset of attributes. The <ra-link-ref> element enables you to avoid—where possible—duplicating resources (such as classes, JARs, image files, and so on). Any values defined in the base resource adapter deployment are inherited by the linked resource adapter, unless otherwise specified in the <ra-link-ref> element.

If you use the optional <ra-link-ref> element, you must provide either all or none of the values in the <pool-params> element. The <pool-params> element values are not partially inherited by the linked resource adapter from the base resource adapter.

Do one of the following:

For instructions on editing the weblogic-ra.xml file, see weblogic-ra.xml Deployment Descriptor Elements.


Configuring the Transaction Level Type

You must specify the transaction level type supported by the resource adapter in the ra.xml deployment descriptor file. To specify the transaction support level:

For instructions on editing an .xml file, see weblogic-ra.xml Deployment Descriptor Elements.

For more information on specifying the transaction level in the RAR configuration, see "Resource Adapter XML DTD" under "Packaging and Deployment" in the J2EE Connector Specification, Version 1.0 Final Release (


Skip navigation bar  Back to Top Previous Next