Reputation: 7
Say I have class SuperNode
and an interface Node
:
SuperNode implements Node
I have a RMI-Implementation server side and I'm trying to just send the Node over from a method without the user having the source file for SuperNode but they do have the interface Node.
public Node RMIImplServer.getNode();
When I do this I get this error:
java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.lang.ClassNotFoundException: SEHT.somepackage.SuperNode (no security manager: RMI class loader disabled) at sun.rmi.server.UnicastRef.invoke(Unknown Source) at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unknown Source) at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source) at com.sun.proxy.$Proxy0.getDataNodes(Unknown Source) Caused by: java.lang.ClassNotFoundException: SEHT.somepackage.SuperNode (no security manager: RMI class loader disabled) at sun.rmi.server.LoaderHandler.loadClass(Unknown Source) at sun.rmi.server.LoaderHandler.loadClass(Unknown Source) at java.rmi.server.RMIClassLoader$2.loadClass(Unknown Source) at java.rmi.server.RMIClassLoader.loadClass(Unknown Source) at sun.rmi.server.MarshalInputStream.resolveClass(Unknown Source) at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source) at java.io.ObjectInputStream.readClassDesc(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at java.util.ArrayList.readObject(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeReadObject(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at sun.rmi.server.UnicastRef.unmarshalValue(Unknown Source) ... 5 more
Is what I'm trying to do possible, if so what am I doing wrong, any help would be appreciated.
Finally figured it out...the jar file wasn't including the right files due to a stupid default that I didn't check. Thank you so much EJP for your help.
Upvotes: 0
Views: 527
Reputation: 311039
The client doesn't need any source files. It does however need the object files (.class) files for all types returned by remote methods, available on its CLASSPATH, unless:
... if you don't want to deploy SuperNode.class
or whatever it is at the client, you can use the codebase feature. It's complicated.
java.rmi.server.codebase
at the server JVM.Upvotes: 0