OC4J 10.1.3.1 allows lookup of EJBs across application by enabling the global JNDI lookup.
To use the global JNDI feature in OC4J, first you have to enable it.
1. Using a text editor, open config/server.xml.
2. Within the <application-server> element, add the global-jndi-lookup-enabled attribute and set it to true as follows:
3. Save and close server.xml.
4. Restart the application server.
5. Deploy application that contains the EJB. Let us say the application name is APP2 that contains a remote EJB with JNDI location “EmployeeFacadeBean”.
To find the JNDI location look at the generated orion-ejb-jar.xml in the server’s application deployment directory. To configure a different JNDI location package an orion-ejb-jar.xml as follows:
The default JNDI name is the name of the remote interface of the session bean configured using the ejb-name element in ejb-jar.xml or name element of @Stateless or @Stateful annotations.
The client application that looks up the EJB must package the remote, home, interfaces to look up the remote EJB.
You can lookup the EJB from the client application using the JNDI location as follows:
Context ctx = new InitialContext();
employeeFacade = (EmployeeFacade) ctx.lookup("EmployeeFacadeBean");
Now you deploy your client application and the application should be able to lookup the EJB in APP2!
If you want to use in OC4J 10.1.3.0.0 then make sure that you apply 10.1.3.1 patchset!