• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI Registry

 
GD Deepz
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is probably a simple problem. I have many clients instianting remote objects i.e One client for one remote object BUT if the first client gets one remote object after creating the registry but when the second client tries to get a second remote object I run into a problem: my method looks like this:

Registry registry = LocateRegistry.getRegistry(host, port);
if (registry == null) {
LocateRegistry.createRegistry(port);
}
//Remote Object
RemoteServicesImp remoteServicesObject = new RemoteServicesImp();
Naming.rebind("RemoteServices", remoteServicesObject);
return (IRemoteServices) Naming.lookup("rmi://" + host + ":" + port + "/RemoteServices");

The registry should only be created once which it does when the first client instianties the remote object BUT the second client throws a ConnectRefusedException---why? -- The regisrty has already been created
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The clients don't need to be creating the registry. That should only be done by the server, right? The client will just try to do a lookup.
 
GD Deepz
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are absoultely right Nathan, it was stupid mistake on my part
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic