Python Server Java Client problem with OmniOrb
JDS
jds at iti-oh.com
Mon Oct 1 16:28:27 EDT 2001
Hi:
I am trying to run a simple Hello World program with OmniNames as the
name server on NT. I can launch the naming service and bind the Server
to it. In the client, if I use the IOR for the HelloServant, I don't
have any problem:
--------------
ORB orb = ORB.init(args, null);
String ior = args[0];
org.omg.CORBA.Object obj = orb.string_to_object(ior);
HelloApp.Hello helloRef = HelloHelper.narrow(obj);
String hel = helloRef.sayHello();
System.out.println(hel);
--------------
However if I try to do the same by getting the IOR for the Root and
going down from there, I get errors while running as follows:
---------------
ORB orb = ORB.init(args, null);
String ior = args[0];
org.omg.CORBA.Object obj = orb.string_to_object(ior); // ERROR
NamingContext ncRef = NamingContextHelper.narrow(obj);
NameComponent nc = new NameComponent("Hello", "");
NameComponent path[] = {nc};
Hello helloRef = HelloHelper.narrow(ncRef.resolve(path));
String Hello = helloRef.sayHello();
System.out.println(Hello);
ERROR : java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
at com.sun.corba.se.internal.util.Utility.bytesToInt(Unknown
Source)
at com.sun.corba.se.internal.iiop.CDRInputStream.read_Object(Unknown
Sou
rce)
at com.sun.corba.se.internal.iiop.CDRInputStream.read_Object(Unknown
Sou
rce)
at com.sun.corba.se.internal.corba.ORB.string_to_object(Unknown
Source)
at HelloClient3.main(HelloClient3.java:18)
---------------
The IOR that I give at the commandline is the one I get when I start
omniNames using omniNames -start 10000.
Root Context is IOR:010000002b00000049444c3a6f6d672e6f72672f436f734e616d696e672f
4e616d696e67436f6e746578744578743a312e300000010000000000000027000000010100000e00
00003139382e33302e39362e3231300010270b0000004e616d6553657276696365
Questions:
Q1. Why do I get the above errors?
Q2. How can I get my Java Client to always get the proper IOR for the
Naming Service when I start it up (using the system environment)
Q3. If I am able to get the client to get the root object properly,
can I replace the orb.string_to_object() call by:
org.omg.CORBA.Object objRef =
orb.resolve_initial_references("NameService");
Thanks,
JDS.
jds at iti-oh.com
More information about the Python-list
mailing list