• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

RMI Registry

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are absoultely right Nathan, it was stupid mistake on my part
 
He's dead Jim. Grab his tricorder. I'll get his wallet and this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic