• 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

Problems turning on rmiregistry programmatically

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,
I am having problems when I turn on the rmiregistry programmatically... using LocateRegistry.CreateRegistry.
My RMI servers bind successfully to the registry. However, when I try to connect to these servers, I get NoSuchObjectException.
What could be the problem?
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you trying to create the registry on your local machine or on another machine? The JavaDocs for the LocateRegistry class says this - "Note that a getRegistry call does not actually make a connection to the remote host. It simply creates a local reference to the remote registry and will succeed even if no registry is running on the remote host. Therefore, a subsequent method invocation to a remote registry returned as a result of this method may fail."
 
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
LocateRegistry.createRegistry() only creates a registry locally (and thats working since you can bind to it). It sounds like you're problem is an inconsistency in your Naming.rebind() vs Naming.lookup(). Can you post both of your calls so that we can compare them?
[ April 29, 2004: Message edited by: Chris Shepherd ]
 
Ron Patel
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the code I use to rebind:
The InvokerServer class extends UnicastRemoteObject.
try{
String name = "Invoke";
IInvoke invokee = new InvokerServer();
Naming.rebind(name, invokee);
System.out.println("Invoker is Listening");
}catch (Exception e){
throw new RuntimeException(e.getMessage());
}

Here is the code I use for lookup
IInvoke invoker = (IInvoke) Naming.lookup("//" + 128.238.44.237 + "/Invoke");
128.238.44.237 is the IP address of the machine I am trying to connect to (the one that has the server bound to rmiregistry using the code above)
 
Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm seems like your lookup might not work right. It should all be string like this:

If that change doesn't work, you may need to mirror this string in your rebind like this:

now you may need to do some internal checking to see what your IP is if the server isn't run on a machine with static IP, but once you know what it is, you can slap it in as a string in place of this one.
I think the first suggestion may fix your problem. The second one may just confuse the issue if it doesn't work, but give it a shot and switch back if it doesn't.
Chris
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic