I have 2 processes (let’s name them A and B) in different JVMs, but on the same host. Each of these processes creates an RMI registry (let's call them RegistryA and RegistryB) using
LocateRegistry.createRegistry( int port ). RegistryA listens on the default 1099 port, and RegistryB listens on a different port.
When I try to get a reference to RegistryB from a remote host using
LocateRegistry.getRegistry( String host, int port ) , I always get a reference to RegistryA instead, regardless of the port number I make RegistryB listen on. When I try to get a reference to RegistryB from the same host where it is located, I have to specify as the first argument either the fully qualified domain name of the host or null. If I put the
word “localhost” as the first argument, I again get a reference to RegistryA regardless of what I specify as the second argument.
After a few hours of googling, I found only an advice to use just one RMI registry. But I would like to avoid it to keep process A and process B more isolated from each other.
What could you suggest?
Thank you in advance.