Ive managed to create an RMI application that does what I need to do it quite successfully, but I had trouble finding out where the client gets definitions for remote objects. eg:
I have a server that registers with rmiregistry (allowing clients to call methods on it).
UnicastRemoteObject.exportObject(new Server(), 0);
running reg.list()confirms that my server is indeed added to the registry. I have another remote object (rObj) running on the same JVM as the server. This is not added to the registry.
In my client, I can get the definition of my Server class by looking Serverin rmiregistry:
reg.lookup("Server")
after that he can freely create instances of rObj. My point is where does my client get the definition for rObj, although it has never been added to the registry.
I know that it should come from the server, as where the class and interface are stored. Does connecting with Serverautomatically open a channel to receive other remote classes?
If so, how does the client know what to look at the server for a remote class. Is the server processed almost like an extension for the path to client classes (it will resort to checking the server for classes that arent in their own class path)?
source
share