Two Laptop Bag*
The moose likes Beginning Java and the fly likes RMI issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "RMI issue" Watch "RMI issue" New topic
Author

RMI issue

satya sahu
Ranch Hand

Joined: Mar 26, 2003
Posts: 97
Hi i am trying to execute a simple RMI Program over a network.
I have deployed the interface file and the server file in one system and the client program withe the interface file at another system.
I have ran the server.
Now when i tried to run the client i am getting following exception.

Exception in thread "main" java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: MyServer_Stub (no security manager: RMI class loader disabled)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:84)
at MyClient.main(MyClient.java:17)
Caused by: java.lang.ClassNotFoundException: MyServer_Stub (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:371)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:631)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:200)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1513)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
... 3 more




What should i do to solve this ?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
Is that really a beginner's question? Oughtn't you to have put it on the distributed forum?
I presume you have checked the Exception in the API specification, nd whichever line of your program actually caused the Exception (which from the stack trace shown appears to be one of the "3 more")?
aslam parveez
Ranch Hand

Joined: Apr 25, 2006
Posts: 47
Looks like you are trying to run the client without putting the stub class in the classpath of client program as the stack trace indicates

java.lang.ClassNotFoundException: MyServer_Stub .

When you have an RMI server class you need to create the stub and skeleton for the same. JDK tool rmic will help you in doing that.Upon doing rmic you'll get two classes MyServer_Stub.class and MyServer_Skel.class(If MyServer is the name of your class).These are client side and server side proxies respectively which are basically concerned with marshalling and unmarshalling of parameters to a remote method.

You need to copy the MyServer_Stub.class into the working directory of your client program in the client machine.
 
wood burning stoves
 
subject: RMI issue