views:

128

answers:

1

i need to write a RMI client/server application that the server is running in a different process. when i am running my code in the same process everything is working fine, but when trying to run the server code in a new Process using

ProcessBuilder pb = new ProcessBuilder(
                        "java",
                        "-cp",
                        "bin",
                        "server.CodeboxServerImpl");

i am getting an unbound exception, thrown from the client.

i have started the rmiregestry, and in the code on both the client and the server i am using

Registry reg = LocateRegistry.getRegistry("localhost");.

am i missing something?

A: 

You should ensure that you have started your rmi registery process.

You will throw a RemoteException if you have problems in LocateRegistry.getRegistry, not a NotBoundException.

You may get a NotBoundException if you have not bound the stub in your server to the registry. In your server code, you can bind the ProcessBuilder stub to the registry by calling reg.bind, using a name. The client can then get the stub by that name from the registry.

Give a read here for some more detail.

akf