• 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

need help (urgent)!!!

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, guys,
I have got a strange problem.
I use -Djava.rmi.server.hostname=127.0.0.1 as a property to start my RMI server. In my DBServer class, I use following sentences:
{
String hostname = System.getProperty("java.rmi.server.hostname");
Naming.rebind("rmi://"+hostName+":1099/Server", dbServer);
}
In my client side, I use:
{
(DBServer)Naming.lookup("rmi://"+host+":1099/Server");
} to find the remote object.
The problem is when I enter the IP address of the sever, eg, 127.0.0.1, it works well; but when I enter 127.0.1.0, it still works. If I enter 127.0.0.256, it doesn't work; if I enter 127, 127.0, 127.0.0, and 127.1.0.0, it doesn't work. It seems that when RMI looking for the reference of the remote object, it ignores the last two digit of the IP address.
Please help to fix it. I will take the exam at the beginning of next month.
Thanks a lot!
macellow
 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
127.*.*.* is loop address. But normally, only 127.0.0.1 is considered to be the "genuine" loop address.
As for your test:
127.0.0.256: 256 is invalid. 255 is for broadcast. You may use any number >0 and <255
127, 127.0, 127.0.0 are invalid IP addresses.
127.1.0.0 should work. If not, try to change it into 127.1.0.1. If works, then the last number can't be 0.
BTW, I don't think what you are experiencing is required in the project.
-- Laudney
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic