[omniORB] Inter-ORB

Filippo Lambiente filippo.lambiente@eudra.org
Thu, 25 Nov 1999 12:36:03 +0000


--------------AEDB29F9F77F660686A04E55
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

this is the java-client code (JDK 1.1.7) that I'm using to get the
reference of the omniORB 2.8 NameService.

public class client {
   public static void main(String args[])
    {
        try{
            Properties props = new Properties();
            //myHost is the host were omniNames runs
            props.put("org.omg.CORBA.ORBInitialHost", <myHost>);
            //myHost is the host were omniNames is listening
            props.put("org.omg.CORBA.ORBInitialPort", <myPort>);

            System.out.println("Inizializzo ORB...");
            // create and initialize the ORB
            org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, props);

            System.out.println("Inizializzato ORB");

            // get the root naming context
            System.out.println("NameService....");
            org.omg.CORBA.Object objRef =
orb.resolve_initial_references("NameService");
            //System.out.println("NameService: " + args[0]);
            //org.omg.CORBA.Object objRef =
orb.string_to_object(args[0]);
            .....
            ....
And this is the output:
$ java client
Inizializzo ORB...
Inizializzato ORB
NameService....
ERROR : exception InvalidName{}
exception InvalidName{}
        at java.lang.Throwable.<init>(Compiled Code)
        at java.lang.Exception.<init>(Compiled Code)
        at org.omg.CORBA.UserException.<init>(Compiled Code)
        at org.omg.CORBA.ORBPackage.InvalidName.<init>(Compiled Code)
        at
com.visigenic.vbroker.orb.ORB.resolve_initial_references(Compiled Code)
        at client.main(Compiled Code)

Also, if I just use the following code with the IOR of the NameService:
            org.omg.CORBA.Object objRef = orb.string_to_object(args[0]);

            if (objRef == null)
                System.out.println("objRef null");
            System.out.println("Ottengo il riferimento al name
context...");
            org.omg.CosNaming.NamingContext ncRef =
org.omg.CosNaming.NamingContextHelper.narrow(objRef);
            System.out.println("Ottenuto il riferimento al name
context");
            if (ncRef == null)
                System.out.println("NameContext null");

and I always get a null name context as you can see from the following
output:
$ java client
IOR:000000000000002849444c3a6f6d672e6f72672f436f734e616d696e672f4e616d696e67436f6e746578743a312e3000000000010000000000000028000100000000000e3139332e3133312e36352e313200270f0000000c383ab35aba4226da00000002

Inizializzo ORB...
Inizializzato ORB
NameService....
Ottengo il riferimento al name context...
Ottenuto il riferimento al name context
NameContext null
ERROR : java.lang.NullPointerException
java.lang.NullPointerException
        at client.main(Compiled Code)

While if I use the C++ client everithing works fine.
Any suggestions?
cheers
filippo

--------------AEDB29F9F77F660686A04E55
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi,
<p>this is the java-client code (JDK 1.1.7) that I'm using to get the reference
of the omniORB 2.8 NameService.
<p>public class client {
<br>&nbsp;&nbsp; public static void main(String args[])
<br>&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try{
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Properties props = new Properties();
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//myHost is the host were omniNames runs
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
props.put("org.omg.CORBA.ORBInitialHost", &lt;myHost>);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//myHost is the host were omniNames is listening
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
props.put("org.omg.CORBA.ORBInitialPort", &lt;myPort>);
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("Inizializzo
ORB...");
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// create and initialize the ORB
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, props);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
System.out.println("Inizializzato ORB");
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //
get the root naming context
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
System.out.println("NameService....");
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");</b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//System.out.println("NameService: " + args[0]);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//org.omg.CORBA.Object objRef = orb.string_to_object(args[0]);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.....
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
....
<br>And this is the output:
<br>$ java client
<br>Inizializzo ORB...
<br>Inizializzato ORB
<br>NameService....
<br>ERROR : exception InvalidName{}
<br>exception InvalidName{}
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.lang.Throwable.&lt;init>(Compiled
Code)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.lang.Exception.&lt;init>(Compiled
Code)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.omg.CORBA.UserException.&lt;init>(Compiled
Code)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.omg.CORBA.ORBPackage.InvalidName.&lt;init>(Compiled
Code)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at com.visigenic.vbroker.orb.ORB.resolve_initial_references(Compiled
Code)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at client.main(Compiled
Code)
<p>Also, if I just use the following code with the IOR of the NameService:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
org.omg.CORBA.Object objRef = orb.string_to_object(args[0]);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (objRef == null)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
System.out.println("objRef null");
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
System.out.println("Ottengo il riferimento al name context...");
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
org.omg.CosNaming.NamingContext ncRef = org.omg.CosNaming.NamingContextHelper.narrow(objRef);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
System.out.println("Ottenuto il riferimento al name context");
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
i<b>f (ncRef == null)</b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
System.out.println("NameContext null");
<p>and I always get a null name context as you can see from the following
output:
<br>$ java client IOR:000000000000002849444c3a6f6d672e6f72672f436f734e616d696e672f4e616d696e67436f6e746578743a312e3000000000010000000000000028000100000000000e3139332e3133312e36352e313200270f0000000c383ab35aba4226da00000002
<br>Inizializzo ORB...
<br>Inizializzato ORB
<br>NameService....
<br>Ottengo il riferimento al name context...
<br>Ottenuto il riferimento al name context
<br>NameContext null
<br>ERROR : java.lang.NullPointerException
<br>java.lang.NullPointerException
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at client.main(Compiled
Code)
<p>While if I use the C++ client everithing works fine.
<br>Any suggestions?
<br>cheers
<br>filippo</html>

--------------AEDB29F9F77F660686A04E55--