Migrating Resource Adapters from OC4J to WebLogic, Part 2 Inbound

Resource adapters can be classified into three categories: outbound, inbound and bi-directional. Previous article has shown you how to deal with outbound case. In this article, we will teach you how to deal with inbound case. It would be easy to understand how to deal with bi-directional case after reading outbound case and inbound case.


l       Mapping for Inbound Case

In inbound case, data flows from EIS to application server through adapters. According to connector 1.5 specification, an adapter can deliver inbound messages to MDB. This requires application server to provide its solution to associate the MDB with adapter. On OC4J, such association is defined in orion-ejb-jar.xml, while on WebLogic in weblogic-ejb-jar.xml. orion-ejb-jar.xml also contains configuration of activation spec.


Furthermore, it is normally necessary to define one or more admin objects in inbound case, such as the Queue, Topic etc. These admin object instances are defined in oc4j-connectors.xml on OC4J, and in weblogic-ra.xml on WebLogic.


You may have noticed that there is just one single descriptor file, weblogic-ra.xml, used on WebLogic for both inbound and outbound adapter. This is different on OC4J where 2 files are used: oc4j-ra.xml and oc4j-connectors.xml.


The mapping from OC4J to WebLogic involves 2 steps: fist, map oc4j-connectors.xml to weblogic-ra.xml; second, map orion-ejb-jar.xml to weblogic-ejb-jar.xml and ejb-jar.xml.



l       Map oc4j-connectors.xml

Let's map oc4j-connectors.xml to weblogic-ra.xml first.

Here is a sample oc4j-connectors.xml descriptor of OC4J which shows a typical configuration for inbound. For standalone adapters, there is one single global file existing for all standalone adapters, and the default location is j2ee/<instance>/config/oc4j-connectors.xml.

<?xml version="1.0" encoding="UTF-8"?>


<oc4j-connectors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/oc4j-connectors-10_0.xsd" schema-major-version="10" schema-minor-version="0" >

           <connector name="fooConnector" path="fooConnector.rar">

                     <adminobject-config location="eis/MyAdminObject">


                                <config-property name="host" value="localhost"/>

                                <config-property name="port" value="1234"/>






Each adminobject-config element defines an admin object instance. It should be mapped to weblogic-connector\admin-objects\admin-object-group\admin-object-instance element on WebLogic. Note: One different is that each admin object instance is identified by adminobject-class on OC4J but by admin-object-interface on WebLogic. So it is necessary to check ra.xml to find out the corresponding adminobject-interface value. This difference is caused by the fact that Connector 1.5 specification doesn't define uniqueness of admin object. In the latest Connector 1.6 specification, it is clarified that the combination of adminobject-interface and adminobject-class must be unique in ra.xml.


The location attribute defines where the admin object instance will be bind to JNDI. This should be mapped to admin-object-instance\jndi-name element on WebLogic.


Each property of this admin object instance is defined by a config-property element. It can be mapped to admin-object-instance\ properties\ property element


Here is the result after performing above mapping, and the result file should be packaged as META-INF\weblogic-ra.xml in the RAR file.

<weblogic-connector xmlns="http://www.bea.com/ns/weblogic/90">

























l       Map orion-ejb-jar.xml

Now let's do the second step, map orion-ejb-jar.xml to weblogic-ejb-jar.xml.


Here is a sample orion-ejb-jar.xml descriptor of OC4J which associates MDB with adapter, and defines 2 properties for activation spec. It should be packaged as META-INF\orion-ejb-jar.xml in the MDB's jar file.

<?xml version="1.0" encoding="utf-8"?>

<orion-ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-ejb-jar-10_0.xsd">


            <message-driven-deployment name="myMDB" destination-location="ejb/myMDB" resource-adapter="fooConnector">












The key element is resource-adapter="fooConnector" which specifies the adapter with which this MDB should associate. You may have noticed that "fooConnector" is the name of the connector, either defined by name="fooConnector" in oc4j-connectors.xml, or by connector-name="fooConnector" in oc4j-ra.xml. WebLogic takes different approach with OC4J. On WebLogic, adapter can be bound to JNDI using element weblogic-connector\jndi-name, and MDB can specify the JNDI name of the adapter that it wants to associate with using element weblogic-enterprise-bean\message-driven-descriptor\resource-adapter-jndi-name.


Each config-property element defines one name/value for a property of the activation spec for this MDB. These values are used to override the values defined in enterprise-beans\message-driven\activation-config\activation-config-property elements in ejb-jar.xml. WebLogic doesn't support such override now and just uses values defined in ejb-jar.xml. So in above case, the ejb-jar.xml contained in MDB jar must be modified to take the value defined in orion-ejb-jar.xml.


Here is the result weblogic-ejb-jar.xml after performing above mapping, and the result file should be packaged as META-INF\weblogic-ejb-jar.xml in the MDB jar file.

<?xml version = "1.0" encoding = "UTF-8"?>

<weblogic-ejb-jar xmlns="http://xmlns.oracle.com/weblogic/weblogic-ejb-jar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-ejb-jar" http://xmlns.oracle.com/weblogic/weblogic-ejb-jar/1.0/weblogic-ejb-jar.xsd ">










Here is the ejb-jar.xml which contains the values of activation spec defined in orion-ejb-jar.xml, and the file should be packaged as META-INF\ ejb-jar.xml in the MDB jar file.

<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" version="3.0" >























After performing above steps, the mapping for inbound case completes.


l       Mapping for Bi-Directional Case

If the adapter is bi-directional that supports both outbound and inbound, there will be 3 descriptors on OC4J:

n       oc4j-ra.xml, for outbound, inside RAR

n       oc4j-connectors.xml, for inbound, inside RAR

n       orion-ejb-jar.xml, for inbound, inside MDB JAR


They should be mapped to 3 descriptors on WebLogic:

n       weblogic-ra.xml, for both outbound and inbound, inside RAR

n       weblogic-ejb-jar.xml, for inbound, inside MDB JAR

n       ejb-jar.xml, for activation spec configurations of inbound, inside MDB JAR


You can figure out how to do mapping easily based on the information in outbound section and inbound section.



l       Reference

Detailed information on configuring and developing resource adapters on WebLogic is available at Programming Resource Adapters for Oracle WebLogic Server. You can find detailed explanation for weblogic-ra.xml schema in appendix "A. weblogic-ra.xml Schema"


Information on MDB is available at Programming Enterprise JavaBeans for Oracle WebLogic Server and Programming Enterprise JavaBeans, Version 3.0 for Oracle WebLogic Server



I liked that last comment. It made me laugh.

Posted by Spy Phone Guy on March 12, 2010 at 03:15 AM PST #

High quality info. Keep up the great work.Very Useful blog

Posted by Get Backlinks on February 28, 2011 at 10:36 PM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

The official blog for Oracle WebLogic Server fans and followers!

Stay Connected


« July 2016