• Post Reply Bookmark Topic Watch Topic
  • New Topic

RMI and Naming.lookup problem  RSS feed

 
Tim Adam Cooper
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In writing a Java program using RMI, I am having a problem with the code as below:
Naming.lookup("//Honda/Weather");
Honda is the name of the server.
A client program refused to connect to the Server called Honda.
But when I used the code below:
Naming.lookup("//172.16.30.121/Weather");
where 172.16.30.121 is the IP address of Honda, the program work and I am able to connect to the server called Honda.
I am puzzled on why if I used the IP address the program work, but if I used the name "Honda", it will not work.
Can anybody shed some light on it?
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am puzzled on why if I used the IP address the program work, but if I used the name "Honda", it will not work.

As javadocs indicate, the parameter to lookup() is a URL-formatted name for the remote object. To find the object, the lookup() method must know where it is. Now, if your server DNS is "Honda", that will work, otherwise what is "Honda"?
To find out your machine name run this (from command prompt in Windows): ping localhost.
Eugene.
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim, your question is not regarding the SJCD Certification. Therefore, I am moving this thread to another Forum
Mark
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!