Johns post lead me in the right direction http://www.javasoft.com/products/jdk/1.2/docs/guide/rmi/codebase.html#sixStepC
However I am still unable dynamically load the stub via RMI.
I can get it to work with the servlet if I specify the jar file that contains the stub in the jserv.properties file with
wrapper.classpath=/pathtomyjar/myjar.jar
I wish I can get RMI to dynamically load the stub and skell to the client.

I can dynamically load from RMI in a Java application (without specifying the path to the .jar that contains the stub).

I think there is some classpath problem that I'm still trying to nail down.

Bart Huseman wrote:

I am having the same problems as you stated in your question.  However, I
cannot get past the unmashalling exception.  I you have any helpful advise
or even a cut and paste in a email of an example of what you did to you jserv.properties I would appreciate it.     Thank you.
 
 

Here is my situation.
I can access an EJB through a Java application.

Java Application Client -> RMI -> --> EJBServer-> JNDI -> MyEJB

I do not need to specify the path to MyEJB because it is found though
the EJBServer

However when I run a similar client as a servlet instead of an
application, I get the message

Cannot lookup CategoryHome: javax.naming.CommunicationException [Root
exception is java.rmi.UnmarshalException: error unmarshalling return;
nested exception is:
 java.lang.ClassNotFoundException:
com.mytoc.ejb.category.JOnASCategoryBeanCategoryHome_Stub]

If I put the path to
com.mytoc.ejb.category.JOnASCategoryBeanCategoryHome_Stub in the
jserv.properties file, I can access the bean.

It seams strange that I would need to specify that path because for one
I don't need to when run as an application and two, I thought that the
EJBServer should find it. I know that the servlet is communicating to
RMI and JNDI because I can access the UserTransaction object by using
PortableRemoteObject.narrow().
By having to specify the path to the stub and skel files handled by
EJBServer there would be know way to load balance and have my EJBs on
remote machines.

Once again, I can make the servlet work if I set a classpath to Jonas
generated class files.
The EJBServer deploys a jar file called Category.jar which contains
com.mytoc.ejb.category.JOnASCategoryBeanCategoryHome_Stub.

Another observation:
If the classpath in the servlet environment points to a duplicate
Category.jar in a different location than the EJBServer deploys, the
servlet will work. So, maybe the servlet needs the definitions of the
stub and skel files but actually accesses it through the EJBServer.
That is my conclusion. Has anybody else encountered a similar situation?

Reply via email to