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

Ipv6 address throws Non-numeric port number error

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 6
    • core-libs
    • b49
    • generic
    • generic

      Name: dk106046 Date: 05/05/2004

      OPERATING SYSTEM(S):
      Red Hat Enterprise Linux AS release 3 (Taroon Update 1) and Windows XP.

      JAVA VERSION:
      java version "1.5.0-beta2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b37)
      Java HotSpot(TM) Client VM (build 1.5.0-beta2-b37, mixed mode)


      When trying to use IPv6 loopback address (::1) in java.naming.provider.url

      eg) -Djava.naming.provider.url=iiop://[::1]:2809

      The following exception is thrown:
      Trouble: javax.naming.ConfigurationException: Nonnumeric port number: [::1]:2809
      javax.naming.ConfigurationException: Nonnumeric port number: [::1]:2809
              at com.sun.jndi.cosnaming.CNCtx.initUsingIiopUrl(CNCtx.java:302)
              at com.sun.jndi.cosnaming.CNCtx.initUsingUrl(CNCtx.java:245)
              at com.sun.jndi.cosnaming.CNCtx.initOrbAndRootContext(CNCtx.java:209)
              at com.sun.jndi.cosnaming.CNCtx.<init>(CNCtx.java:69)
              at com.sun.jndi.cosnaming.CNCtxFactory.getInitialContext(CNCtxFactory.java:32)
              at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
              at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
              at javax.naming.InitialContext.init(InitialContext.java:219)
              at javax.naming.InitialContext.<init>(InitialContext.java:175)
              at HelloServer.main(HelloServer.java:12)

      Result:
      Unable to run ORB tests with IPv6 address in numeric format.

      Expected Result:
      Should be able to process the IPv6 address in numeric format without any error/exception.

      Steps to Recreate:
      1) On a Windows XP Service pack 1, do the followign to enable IPv6.
      Open a command prompt
      Type ipv6 install
      You should see the following
      D:\svt\ipv6\test>ipv6 install
      Installing...
      Succeeded.
      Type ping ::1 .You should see

      D:\svt\ipv6\test>ping ::1

      Pinging ::1 with 32 bytes of data:

      Reply from ::1: time<1ms
      Reply from ::1: time<1ms
      Reply from ::1: time<1ms
      Reply from ::1: time<1ms

      Ping statistics for ::1:
      Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
      Approximate round trip times in milli-seconds:
      Minimum = 0ms, Maximum = 0ms, Average = 0ms

      This is to confirm IPv6 loopback is responding.

      2) Download and unjar test.jar
      3) set CLASSPATH=.
      4) javac *.java
      5) rmic -iiop HelloImpl
      6) start tnameserv -J-Djava.net.preferIPv4Stack=false -ORBInitialPort 2809
      7) Start the server:
      java -Djava.net.preferIPv4Stack=false -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
      -Djava.naming.provider.url=iiop://[::1]:2809 -Dcom.ibm.CORBA.Debug=true -Dcom.ibm.CORBA.CommTrace=true HelloServer

      To recreate the problem on Linux follow steps from 2 to 7 on a machine which has IPv6 enabled.

      TEST.JAR:
      Hello.java:
      import java.rmi.RemoteException;
      import java.util.*;

      public interface Hello extends java.rmi.Remote {
          public String sayHello() throws RemoteException;
      }

      HelloClient.java:
      import java.rmi.RemoteException;
      import java.net.MalformedURLException;
      import java.rmi.NotBoundException;
      import javax.naming.NamingException;
      import javax.naming.InitialContext;
      import javax.naming.Context;
      import javax.rmi.PortableRemoteObject;
      import java.util.*;

      public class HelloClient {
          public static void main(String[] args) {
              Object objectRef=null;
              try {
                      Context context = new InitialContext();
                      objectRef=context.lookup("HelloServer");
                      Hello hello =(Hello) PortableRemoteObject.narrow(objectRef, Hello.class);
                      System.out.println(hello.sayHello());
              } catch (Throwable t) {
                      t.printStackTrace();
              }
          }
      }

      HelloServer.java:
      //HelloServer.java
      import javax.naming.InitialContext;
      import javax.naming.Context;
      import javax.rmi.PortableRemoteObject;

      public class HelloServer {
          public static void main(String[] args) {
              try {
                  
                  Hello server = new HelloImpl();
                  Context initialNamingContext = new InitialContext();
                  initialNamingContext.rebind("HelloServer", server );
                  System.out.println("Hello Server: Ready...");
               } catch (Exception e) {
                  System.out.println("Trouble: " + e);
                  e.printStackTrace();
               }
           }
      }

      HelloImpl.java:
      import javax.rmi.PortableRemoteObject;
      import java.rmi.RemoteException;
      import java.util.*;
      import java.math.*;

      public class HelloImpl extends PortableRemoteObject implements Hello
      {
          public HelloImpl() throws RemoteException
          {
              super();
          }
          public String sayHello() {
              return "hello";
          }
      }


      ======================================================================

            jhangalsunw Jayalaxmi Hangal (Inactive)
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: