hi
thanks for reply.
i am loading the class dynamically.
/***** this code binds the object ******/
import java.rmi.registry.*;
public class Bind{
public static void main(
String[] args) {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
String name = "time";
try {
// TimeServer m = new TimeServer();
Properties p = System.getProperties();
String url = p.getProperty("java.rmi.server.codebase");
Class m = RMIClassLoader.loadClass(url,"TimeServer");
Registry remoteReg = LocateRegistry.getRegistry("vivek",1099);
remoteReg.rebind(name,(Remote) m.newInstance());
System.out.println("TimeServer bound");
} catch (Exception e) {
e.printStackTrace();
}
}
}
vivek is the system name on which i am running the registry.
i am loading the stub using codebase
java -Djava.security.policy=register.policy -Djava.rmi.server.codebase="http://deepak:8080/rmi/" Bind
deepak is my system name.
when i am trying to bind the object to my own registry it is working fine.
but when iam trying to bind to vivek machine's registry it is giving an exception.
java.rmi.ServerException: RemoteException occurred in server thread; nested exception
is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception i
s:
java.lang.ClassNotFoundException: TimeServer_Stub
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:352)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
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:536)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemote
Call.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:350)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at Bind.main(Bind.java:40)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exceptio
n is:
java.lang.ClassNotFoundException: TimeServer_Stub
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:342)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
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:536)
Caused by: java.lang.ClassNotFoundException: TimeServer_Stub
at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:207)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:427)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:159)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:629)
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:1503)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1425)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1616)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1264)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:322)
... 9 more
kindly help..