OK, I decided I would try to figure out how to get this working yesterday
and here is what I came up with.

We have two machines each running Orion:
Machine A - contains the EJBs
Machine B - contains the web stuff

1) Create an application on Machine A that contains the EJBs you want to be
able to access from Machine B.

2) Create an application on Machine B that contains web elements that will
access the EJBs on Machine A (This application must be named the same as the
application on Machine A! Also See Warning below!)

3) Edit the rmi.xml file of Machine B to include a "server" element tag that
points to Machine A.

4) The orion-application.xml for the application on Machine B must include a
tag like:
<ejb-module remote="true" path="doesn't_seem_to_matter" />

5) I had to put the home & remote interfaces of the ejb in the orion/lib
directory on Machine B.  It didn't seem to be able to find the class
definitions otherwise, and I would eventually get this error:
javax.naming.NamingException: Lookup error: java.io.IOException: Class Not
Found
: jason.HelloWorldHome; nested exception is:
        java.io.IOException: Class Not Found: jason.HelloWorldHome
        at com.evermind.server.rmi.RMIContext.lookup(JAX)
        at com.evermind.server.hm.f4(JAX)
        at com.evermind.server.hm.lookup(JAX)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at __jspPage3_jtest_jsp._jspService(__jspPage3_jtest_jsp.java:39)
        at com.orionserver.http.OrionHttpJspPage.service(JAX)
        at com.evermind.server.http.HttpApplication.xj(JAX)
        at com.evermind.server.http.JSPServlet.service(JAX)
        at com.evermind.server.http.d3.sw(JAX)
        at com.evermind.server.http.d3.su(JAX)
        at com.evermind.server.http.ef.s1(JAX)
        at com.evermind.server.http.ef.do(JAX)
        at com.evermind.util.f.run(JAX)

(I am very interested in the solution to this problem, and if anyone knows
please post it to the Orion-Interest list.)

6) I didn't have to add any ejb-ref tags to my web.xml, I was able to access
the remote EJB by doing the usual context lookup, narrowing, etc., from
within a jsp.

7) Watch your web talk to the EJBs


-----------
! Warning !
-----------
Machine A must have at least the same applications that Machine B defines!
If you don't then you will get a NullPointerException on Machine A that
looks like:
java.lang.NullPointerException
        at com.evermind.server.rmi.a7.gr(JAX)
        at com.evermind.server.rmi.a7.resolveClass(JAX)
        at java.io.ObjectInputStream.inputClassDescriptor(Unknown Source)
        at java.io.ObjectInputStream.readObject(Unknown Source)
        at java.io.ObjectInputStream.readObject(Unknown Source)
        at java.io.ObjectInputStream.inputObject(Unknown Source)
        at java.io.ObjectInputStream.readObject(Unknown Source)
        at java.io.ObjectInputStream.readObject(Unknown Source)
        at com.evermind.server.rmi.ba.hg(JAX)
        at com.evermind.server.rmi.ba.run(JAX)
        at com.evermind.util.f.run(JAX)

I am speculating that this is because of the "shared" application namespace
stuff that seems to be going on, but I could be way off base here.  Note
that you are allowed to have applications on Machine A that are not defined
on Machine B.

My biggest (or more frustrating) gotcha was making sure I could start both
servers after I had placed the <server> tag in the rmi config for the web
machine.  The warning should explain what you need to do to avoid that.
After that was the afore mentioned class location problem.  Regardless, I
hope this helps.

-jason


Reply via email to