[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> public static void main(String args[])
<br> {
<br> try{
<br>
Properties props = new Properties();
<br>
//myHost is the host were omniNames runs
<br>
props.put("org.omg.CORBA.ORBInitialHost", <myHost>);
<br>
//myHost is the host were omniNames is listening
<br>
props.put("org.omg.CORBA.ORBInitialPort", <myPort>);
<p> System.out.println("Inizializzo
ORB...");
<br>
// create and initialize the ORB
<br>
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, props);
<br>
System.out.println("Inizializzato ORB");
<p> //
get the root naming context
<br>
System.out.println("NameService....");
<br>
<b>org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");</b>
<br>
//System.out.println("NameService: " + args[0]);
<br>
//org.omg.CORBA.Object objRef = orb.string_to_object(args[0]);
<br>
.....
<br>
....
<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> at java.lang.Throwable.<init>(Compiled
Code)
<br> at java.lang.Exception.<init>(Compiled
Code)
<br> at org.omg.CORBA.UserException.<init>(Compiled
Code)
<br> at org.omg.CORBA.ORBPackage.InvalidName.<init>(Compiled
Code)
<br> at com.visigenic.vbroker.orb.ORB.resolve_initial_references(Compiled
Code)
<br> at client.main(Compiled
Code)
<p>Also, if I just use the following code with the IOR of the NameService:
<br>
org.omg.CORBA.Object objRef = orb.string_to_object(args[0]);
<br>
if (objRef == null)
<br>
System.out.println("objRef null");
<br>
System.out.println("Ottengo il riferimento al name context...");
<br>
org.omg.CosNaming.NamingContext ncRef = org.omg.CosNaming.NamingContextHelper.narrow(objRef);
<br>
System.out.println("Ottenuto il riferimento al name context");
<br>
i<b>f (ncRef == null)</b>
<br>
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> 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--