Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4097947

Functionality of InetAddress.java changed in 1.1.1; hostname not fully qualified

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P5 P5
    • None
    • 1.1.4
    • core-libs
    • x86
    • windows_nt



      Name: rm29839 Date: 12/08/97


      I'm using jdk1.1.1 to run an rmi server
      on my computer which is connected to the network
      at the the University of Delaware through a
      dial-up ppp acount. The jdk version I'm using on my
      shell account is also 1.1.1. When I try to run a
      rmi server from my computer using my dialin IP
      as the server address, I get an error. Once I start
      the client from my shell account, the name of my
      computer appears on the client side and the client
      reports that it is an unknown host. Just in case
      this was related to the fact that my computer name
      doesn't have a DNS entry (since it's a dialin, and
      is assigned by the server), I changed the name of
      my computer to the current IP of my dialin session.
      It still reports the same error, but now with the IP
      of the server. I tried running the 1.1.1 byte-codes
      (I didn't recompile) on a 1.1 virtual machine and
      it worked! I think this is a strange problem and
      that it shouldn't require this workaround. It
      would seem that something is different with the
      rmiregistry with the 1.1 jdk in that it doesn't
      try to return the machine name, or if it is, it
      does it in a way that the client can find the server.
      I don't see why people using rmi should have to
      use the oldest version of the jdk for the server,
      they should be able to at least use the same version,
      but it would seem that doesn't work. It works GREAT
      if I run the client and sever on the SAME machine,
      but as soon as I split them up, it fails and I have to
      use jdk1.1. It's a great feature (RMI), don't get me wrong,
      but I thought you should be made aware of this problem,
      it's very frustrating. I hope that there will be a
      solution for it.

      here's my code, it's very simple, I made it that
      way just in case the code I originally found the
      problem in was causing a problem due to file I/O,
      which it wasn't. So I tried the simplest example
      possible, still no luck.


      package hello;

      import java.rmi.*;
      import java.rmi.server.*;
      import java.net.*;

      public class HelloImpl extends UnicastRemoteObject implements Hello {

         public HelloImpl() throws RemoteException {
            super();
         }

         public String sayHello() throws RemoteException {
            return "Hello, world!";
         }

         public static void main(String args[]) {

            RMISecurityManager sm = new RMISecurityManager();
      System.setSecurityManager(sm);

            try{
      HelloImpl h = new HelloImpl();
      Naming.rebind("rmi://" + args[0] + "/hello", h);
      System.out.println("Hello server ready.");
            }
      catch (RemoteException e) {
      System.out.println("Exception in HelloImpl.main: " + e);
      }

      catch(MalformedURLException e) {
      System.out.println("MalformedURLException in HelloImpl.main: " + e);
      }
         }
      }


      package hello;
      import java.rmi.*;

      public class HelloClient {

         public static void main(String args[]) {

      RMISecurityManager sm = new RMISecurityManager();
      System.setSecurityManager(sm);

      try{
      Hello h = (Hello)Naming.lookup("rmi://" + args[0] + "/hello");
      System.out.println("Reference to remote stub has been obtained."); //for debugging

      String message = h.sayHello();
      System.out.println("HelloClient: " + message);
      }
      catch (Exception e) {
      System.out.println("Exception in main: " + e);
      }
         }
      }

      package hello;

      import java.rmi.*;

      public interface Hello extends Remote {

         public String sayHello() throws java.rmi.RemoteException;

      }


      Here's the exact text produced by the client
      when the error occurs, the server doesn't report
      any error, it fact, when I set the LogStream
      to report to System.out, it never even got
      as far as leasing the object.

      > java hello.HelloClient 128.175.98.92
      Reference to remote stub has been obtained.
      Exception in main: java.rmi.UnknownHostException: Unknown host: [zeppelin:1165];
       nested exception is:
              java.net.UnknownHostException: zeppelin
      >
      (Review ID: 21503)
      ======================================================================

            ldorninsunw Laird Dornin (Inactive)
            rmandelsunw Ronan Mandel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: