[omniORB] AIX JDK 1.2.2 and omniNames 2.8.0

Daniel M. Johnson Daniel_M._Johnson/MCLEOD@McLeodUSA.com
Thu, 8 Jun 2000 11:16:31 -0500


I am having a problem getting IBM's JDK 1.2.2 for AIX working with omniNames.

Basically the resolve_initial_references call fails as shown in the stack trace
below.  Apparently IBM has rewritten the CORBA portion of their JDK.
Hence the com.ibm.rmi.corba, rather than com.sun.corba.

The code attached works fine from an NT machine, or even the AS/400.  In both
cases I still used the same omniNames service on the AIX machine.

This code also works if I use IBM's namingservice that comes with the AIX JDK
instead of omniNames.

Has anyone run into this or know of a solution?

Thanks!
Dan Johnson

dmjohns@f2n1::/home/dmjohns/dmdsdev/dev/sam1> java
-Dorg.omg.CORBA.ORBInitialPort=13120 HelloServer
IOR:000000000000001749444c3a48656c6c6f4170702f48656c6c6f3a312e300000000000010000000000000058000101000000000b31302e322e32382e3535000087d3000

000000018afabcafe000000025cdc631c000000080000000000000000000000010000000100000018000000000001000100000001000100200001010000000000

Resolving initial references...
ERROR: java.lang.NullPointerException
java.lang.NullPointerException
        at
com.ibm.rmi.corba.ClientDelegate.consumeServiceContexts(ClientDelegate.java:314)
        at com.ibm.rmi.corba.ClientDelegate.invoke(ClientDelegate.java:161)
        at
com.ibm.rmi.corba.InitialNamingClient.resolve(InitialNamingClient.java:192)
        at
com.ibm.rmi.corba.InitialNamingClient.cachedInitialReferences(InitialNamingClient.java:271)

        at
com.ibm.rmi.corba.InitialNamingClient.resolve_initial_references(InitialNamingClient.java:180)

        at com.ibm.rmi.corba.ORB.resolve_initial_references(ORB.java:1158)
        at HelloServer.main(HelloServer.java:28)


I know it's hitting the nameservice because when I run with this command line
(i.e. a port where there is no namingservice), I get this exception:

dmjohns@f2n1::/home/dmjohns/dmdsdev/dev/sam1> java
-Dorg.omg.CORBA.ORBInitialPort=13121 HelloServer
IOR:000000000000001749444c3a48656c6c6f4170702f48656c6c6f3a312e300000000000010000000000000058000101000000000b31302e322e32382e3535000087e8000

000000018afabcafe000000025cdc9df4000000080000000000000000000000010000000100000018000000000001000100000001000100200001010000000000

Resolving initial references...
ERROR: org.omg.CORBA.COMM_FAILURE:   minor code: 1  completed: No
org.omg.CORBA.COMM_FAILURE:   minor code: 1  completed: No
        at com.ibm.rmi.iiop.ConnectionTable.get(ConnectionTable.java:116)
        at com.ibm.rmi.iiop.GIOPImpl.createRequest(GIOPImpl.java:67)
        at
com.ibm.rmi.corba.ClientDelegate.createRequest(ClientDelegate.java:378)
        at
com.ibm.rmi.corba.InitialNamingClient.resolve(InitialNamingClient.java:190)
        at
com.ibm.rmi.corba.InitialNamingClient.cachedInitialReferences(InitialNamingClient.java:271)

        at
com.ibm.rmi.corba.InitialNamingClient.resolve_initial_references(InitialNamingClient.java:180)
        at com.ibm.rmi.corba.ORB.resolve_initial_references(ORB.java:1158)
        at HelloServer.main(HelloServer.java:28)

hello.idl:
module HelloApp
{
    interface Hello
    {
        string sayHello();
    };
};

HelloServer.java:
import HelloApp.*;
import org.omg.CORBA.*;

class HelloServant extends _HelloImplBase
{
    public String sayHello()
    {
        return "\nHello world !!\n";
    }
}


public class HelloServer {

    public static void main(String args[])
    {
        try{
//            System.getProperties().put("org.omg.CORBA.ORBClass",
"com.sun.CORBA.iiop.ORB");
//            System.getProperties().put("org.omg.CORBA.ORBSingletonClass",
"com.sun.CORBA.iiop.ORB");


            // create and initialize the ORB
            ORB orb = ORB.init(args, null);


            // create servant and register it with the ORB
            HelloServant helloRef = new HelloServant();
            orb.connect(helloRef);

            System.out.println(orb.object_to_string(helloRef));

            System.out.println( "Resolving initial references..." );
            org.omg.CORBA.Object objRef = orb.resolve_initial_references(
"NameService" );
            System.out.println( "Narrowing..." );
            org.omg.CosNaming.NamingContext ncRef =
org.omg.CosNaming.NamingContextHelper.narrow( objRef );

            System.out.println( "Naming Components..." );
            // Resolve the object reference in naming
            System.out.println( "Online Status Naming Components.." );
            org.omg.CosNaming.NameComponent nc1 = new
org.omg.CosNaming.NameComponent( "test", "Object" );

            System.out.println( "defining path.." );
            org.omg.CosNaming.NameComponent path[] = {nc1};

            ncRef.rebind(path,helloRef);
            System.out.println("Bound OK");

            // wait for invocations from clients
            java.lang.Object sync = new java.lang.Object();
            synchronized (sync) {
                sync.wait();
            }

        } catch (Exception e) {
            System.err.println("ERROR: " + e);
            e.printStackTrace(System.out);
        }
    }
}


HelloClient.java:
import HelloApp.*;
import org.omg.CosNaming.*;
import org.omg.CORBA.*;

public class HelloClient
{
    public static void main(String args[])
    {
        try{
//            System.getProperties().put("org.omg.CORBA.ORBClass",
"com.sun.CORBA.iiop.ORB");
//            System.getProperties().put("org.omg.CORBA.ORBSingletonClass",
"com.sun.CORBA.iiop.ORB");
            // create and initialize the ORB
            ORB orb = ORB.init(args, null);


            System.out.println( "Resolving initial references..." );
            org.omg.CORBA.Object objRef = orb.resolve_initial_references(
"NameService" );
            System.out.println( "Narrowing..." );
            org.omg.CosNaming.NamingContext ncRef =
org.omg.CosNaming.NamingContextHelper.narrow( objRef );

            System.out.println( "Naming Components..." );
            // Resolve the object reference in naming
            System.out.println( "Online Status Naming Components.." );
            org.omg.CosNaming.NameComponent nc1 = new
org.omg.CosNaming.NameComponent( "test", "Object" );

            System.out.println( "defining path.." );
            org.omg.CosNaming.NameComponent path[] = {nc1};

//            Hello helloRef =
HelloHelper.narrow(orb.string_to_object("IOR:000000000000001749444c3a48656c6c6f4170702f48656c6c6f3a312e300000000000010000000000000034000100000000000e434349442e6d636c642e6e6574004d0900000018afabcafe0000000259f00c24000000080000000000000000"));

            Hello helloRef = HelloHelper.narrow(ncRef.resolve(path));

            // call the Hello server object and print results
            String hello = helloRef.sayHello();
            System.out.println(hello);

        } catch (Exception e) {
            System.out.println("ERROR : " + e) ;
            e.printStackTrace(System.out);
        }
    }
}