wood burning stoves 2.0*
The moose likes Distributed Java and the fly likes Unmarshall exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Unmarshall exception" Watch "Unmarshall exception" New topic
Author

Unmarshall exception

Richard Thatch
Greenhorn

Joined: Feb 16, 2007
Posts: 12
hi,

I am trying to get a basic RMI example working and I am having a problem dealing with the rmiregistry....

when I execute the rmiregistry and try to run my server I get the following error:
$ java MyRemoteImpl
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: MyRemoteImpl_Stub
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:385)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:343)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at MyRemoteImpl.main(MyRemoteImpl.java:32)


However, when I change the server to create a registry and bypass the rmiregistry program, it works fine...

Can anyone tell me what the problem is?

thanks!
Richard Thatch
Greenhorn

Joined: Feb 16, 2007
Posts: 12
well, I did some searching and did find the answer to my question....

it seems that the stub files have to be visible to rmiregistry.

so if you run rmiregistry out of the class area for your app, that will work.
if you put the jar into the classpath, that would work as well...

another question though....

is it possible to have a directory where you put jar files such that all the jar files will be searched when needed by the JVM?


for example:

i have a ~/libs directory that contains:
lib1.jar lib2.jar lib3.jar...

can one put "~/libs" in the classpath such that the jar files will be
searched for classes automatically by the JVM ??

thanks for any help
Rich
kelby zorgdrager
Greenhorn

Joined: Feb 05, 2008
Posts: 12
rmi supports dynamic class loading via a codebase over http.. that is the best way to solve your problem.. but its a bit of a tedious process to get it all set up..


<a href="http://www.J2EETraining.com" target="_blank" rel="nofollow">J2EE Training / Java EE Training ... Learn Java EE </a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unmarshall exception