Wednesday, January 7, 2009

Using remote / local ejb in JDeveloper 11g and WLS

If you want to use EJB as model in your 11G ADF JSF application then you can follow this guide on otn. Using the local interface to an ejb session bean is not so difficult. Just select the ejb session bean and create an datacontrol on this. Then You will get the option to use the Local or Remote interface.

After this you can select and use the ejb methods from the viewcontroller datacontrol window. When you use this local ejb, JDeveloper will add a reference to this ejb in the web.xml. It will use ejb-local-ref element


When you start your application then JDeveloper automatically add this ejb module in the weblogic deployment and the web application will use the ejb-link element to resolve the ejb.

Now let's make it a bit more difficult by using remote interface EJB. We have now two options. You can add this remote ejb to the application workspace then JDeveloper will deploy this ejb too with the web application deployment. The only thing what is different with a local interface ejb is the reference element in the web.xml. It will now use the ejb-ref element.


I think when you choose to use remote ejb then it is wise to deploy this on a different wls then the wls where you web application is running. For this we need to create a new workspace where we will create the remote ejb's. Deploy this ejb to a WLS server other then the WLS of the web application .
When we want to use this ejb with ADF in the web application then we need to create a new datacontrol on this ejb session bean. Now we use the remote interface option. If we want see this datacontrol in the data control window of the web application then we need to make an ADF library deployment.

Deploy this to a jar and add this jar to the viewcontroller project.
There are two ways to do a jndi lookup from the web application to the remote EJB. The first way is to open datacontrols.dcx in the remote ejb wproject and fill the correct jndi properties fields.

<ejb-definition ejb-version="3.0" ejb-name="HRSessionEJB"

The other way is to make a reference element in the web.xml and weblogic.xml in the viewcontroller project. here is the remote ejb reference in the web.xml


and here the weblogic.xml located in the web-inf folder

<?xml version = '1.0' encoding = 'windows-1252'?>
<weblogic-web-app xmlns:xsi="" xsi:schemaLocation="" xmlns="">

Now we only have to make an library for the WebLogic server and add this library to weblogic-application.xml of the viewcontroller project. This library contains the remote ejb classes else we can get a class loading problem and our application can't find the ejb classes. To do this we first have to make a folder where we will add an APP-INF and a META-INF folder and we use an empty dummy jar.

Under the APP-INF folder I created a new folder lib and add the ejb jar to this folder.

In the meta-inf folder we need to create two files MANIFEST.MF and application.xml these files will we used to determine the WLS library name.
We can go the weblogic server console and go to deployment menu where we press the install button and follow the wizards.

When this is successfull we can change the weblogic-application.xml.

<?xml version = '1.0' encoding = 'windows-1252'?>
<weblogic-application xmlns:xsi="" xsi:schemaLocation="" xmlns="">

If you deployed the remote ejb to the same WebLogic server as the web application then everything should work now when you deploy the application.
When you have deployed the remote ejb on a different WLS then we need to create an foreign jndi provider first. Go to the wls console of the web application and create a foreign jndi provider and foreign jndi link. So the web appplication can find the remote ejb on the other Weblogic server.

It can be that you still got errors where you use the remote ejb on a different WLS server. Then you could try to generate ejb client.jar. Use this to add the Welblogic stub classes to the deployment jar of the remote ejb and add jar as a library to the adf wls.

set JAVA_HOME=C:\oracle\MiddlewareJdev11g\jdk160_05
set PATH=C:\oracle\MiddlewareJdev11g\jdk160_05\bin
set CLASSPATH=C:\oracle\MiddlewareJdev11g/wlserver_10.3/server/lib/weblogic.jar

java weblogic.appc C:\projecten\workspace\11g_prod\ADF_EJB_REMOTE\model\deploy\EjbWebServices.jar

here are my example projects.


  1. Is there a way to make ejb calls from 11g WLS to 10g OAS running on jdk 1.5 ?

  2. Hi

    That should be possible but we tried to call the soa suite task ejb but we need to put a ws on it and call this ws from wls.

    you can get some serial id errors but they got osb also working with soa suite.

    thanks Edwin

  3. Hi Edwin,

    Thanks for the post. I am trying to configure the XMPP driver and send a IM Message. After I send the message from my client, when I checked the status of my message at UMS, I saw the below error. Can you please help me out here?

    Status Message: No matching drivers found for delivery type = IM


  4. Hi,

    Did you select the im application driver in the web logic console and target this to the web logic SOA managed server and then reboot


  5. Hi Edwin,
    I have same problem as previous comment has. I didn't understand what do you mean by "select the im application driver in the web logic console and target this to the web logic SOA managed server ". I do everything written here (I think)

  6. Hi,

    What I mean, default these drivers are disabled. These drivers are a EAR application and you can see then in the weblogic console application / deployment.

    select the driver you want to use and open it , here you see a target tab where you can assign it to a soa managed server.