RMI-IIOP interoperability between JOnAS and Weblogic

 

The aim of this document is to show basic usage of interoperability between JOnAS and Weblogic Server using RMI-IIOP (the examples in this document assume that the Sun rmi/iiop of the JDK is used).

This document describes:

  1. Accessing an EJB deployed on JOnAS from an EJB deployed on Weblogic server using RMI-IIOP.
  2. Accessing an EJB deployed on Weblogic Server from an EJB deployed on JOnAS using RMI-IIOP.

Accessing an EJB deployed on JOnAS from an EJB deployed on Weblogic server using RMI-IIOP

JOnAS Configuration

No modification on the EJB code is necessary. However, you should deploy it for the iiop protocol, e.g. when you create the build.xml, add the tag protocols and indicate iiop.
For example:

   <jonas destdir="${dist.ejbjars.dir}" classpath="${classpath}" jonasroot="${jonas.root}" protocols="iiop"/>
    

If you are using GenIC for deploying, you may use the -protocols option, note also that you may deploy an EJB for several protocols, see the JOnAS Configuration Guide about configuring the communication protocol for more details.

In order for the JOnAS server to use RMI-IIOP, you must modify the JOnAS configuration.
In the file carol.properties choose the iiop protocol, see also the JOnAS Configuration Guide for details about configuring the communication protocol.
These modifications enable to create an EJB using RMI-IIOP protocol.

EJB proxy on Weblogic

In order to call an EJB deployed on JOnAS accessible through RMI-IIOP, you must load the class com.sun.jndi.cosnaming.CNCtxFactory as the initial context factory.
You must also specify the JNDI url of the name server containing the EJB to call: "iiop://<server>:port"
For example:

    try {
      Properties h = new Properties();
      h.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
      h.put(Context.PROVIDER_URL, "iiop://<server>:<port>");
      ctx=new InitialContext(h);
      }
    catch (Exception e) {
      ...
      }
    

Then the access to the JOnAS EJB is achieved in the standard way.

Access an EJB deployed on Weblogic Server by an EJB deployed on JOnAS using RMI-IIOP

Weblogic Configuration

No modification on the EJB code is necessary. However, you should deploy it for the iiop protocol, e.g. when you create the build.xml, add the element iiop="true" on the wlappc task.
For example:

     wlappc debug="${debug}" source="ejb.jar" iiop="true" classpath="${class.path}"
    

EJB proxy on JOnAS

In order to call an EJB deployed on Weblogic Server accessible through RMI-IIOP, specify the JNDI url of the name server containing the EJB to call. This url is of type: "iiop://<server>:port".
For example:

 
      try {
         Properties h = new Properties();
         h.put(Context.PROVIDER_URL, "iiop://<server>:<port>");
         ctx=new InitialContext(h);
      }
      catch (Exception e) {
          ...
      }
    

Then the access to the EJB deployed on Weblogic server is done in the standard way.