I have a problem with the LocateRegistry.createRegistry(int port) method.

gunther van roey

The problem is that there can be only one RMI registry created in a Vitrual Machine. (this is a limitation to the concept of RMI).

Since RMI needs to have a few objects with a known Object ID for allowing clients to find the Registry, these can not exist multiple times in the same VM.

(If you search the RMI-user archives at java.sun.com, you'll find a more detailed explanation).

What you can do is start one RMI registry from within your application with LocateRegistry.createRegistry, and start one or more other RMI registries externally (on the command prompt with 'rmiregistry').