[omniORB] JavaIDL and OmniORB

James Dempsey jdempsey@sctcorp.com
Mon, 28 Aug 2000 13:49:52 -0400


I'm not having any problem getting a JavaIDL client to talk to an
OmniORB server.
My command line looks like:

java EchoClient -ORBInitialPort 1050

I've started OmniNames using:

omninames -start 1050

Jim Dempsey
jdempsey@sctcorp.com




                    "Bernard Niset"
                    <bn@7ways.com>                      To:
<aseduto@excite.com>, <omniorb-list@uk.research.att.com>
                    Sent by:                            cc:
                    owner-omniorb-list@uk.resear        Subject:
RE: [omniORB] JavaIDL and OmniORB
                    ch.att.com


                    08/28/00 01:19 PM
                    Please respond to bn





I had the same problem this week-end. I guess it's a bug in Sun's
Java. Try
to use the ior to connect to your server object and you'll see that it
works.

-----Original Message-----
From: owner-omniorb-list@uk.research.att.com
[mailto:owner-omniorb-list@uk.research.att.com]On Behalf Of
aseduto@excite.com
Sent: lundi 28 aout 2000 18:24
To: omniorb-list@uk.research.att.com
Subject: [omniORB] JavaIDL and OmniORB

Hi Everybody:

I am trying to use OmniOrb as Server and JavaIDL as Client. Looking at
the
archive of this mailing list it seem it is possible.
Unfortunately up to now I have been unsuccessful.

I always get the same errors from the java client. I am trying to
comunicate
with the echo server example.

java.lang.ArrayIndexOutOfBoundsException
        at
com.sun.corba.se.internal.util.Utility.bytesToInt(Utility.java:1032)
        at
com.sun.corba.se.internal.iiop.CDRInputStream.read_Object(CDRInputStream.jav


a:600)
        at
com.sun.corba.se.internal.iiop.CDRInputStream.read_Object(CDRInputStream.jav


a:572)
        at
com.sun.corba.se.internal.corba.InitialNamingClient.resolve(InitialNamingCli


ent.java:209)
        at
com.sun.corba.se.internal.corba.InitialNamingClient.cachedInitialReferences



InitialNamingClient.java:265)
        at
com.sun.corba.se.internal.corba.InitialNamingClient.resolve_initial_referenc


es(InitialNamingClient.java:188)
        at
com.sun.corba.se.internal.corba.ORB.resolve_initial_references(ORB.java:1393


)
        at NameClientList.main(NameClientList.java:22)

This is the java code at line 22 that generate the error:

orb.resolve_initial_references("NameService")

I know the setting for the port are correct since if I change them I
get a
CORBA.COMM_FAILURE error.

Any help would be greatly appreciated.

Alessandro




This is the java code.



import Echo.*;           // The package containing our stubs.
import org.omg.CosNaming.*;  // HelloClient will use the naming
service.
import org.omg.CORBA.*;      // All CORBA applications need these
classes.
import org.omg.CORBA.ORB.*;
import java.util.*;

public class EchoClient
{
    public static void main(String args[])
    {
        EchoClient t = new EchoClient();
            t.t(args);
    }

    void t(String args[]){
        try{
                org.omg.CORBA.Object object;
                java.util.Properties props = new java.util.Properties
();
                props.put("org.omg.CORBA.ORBInitialHost", "surraa");
                props.put("org.omg.CORBA.ORBInitialPort", "2090");


                ORB orb = ORB.init(args, props);

                System.err.println("Searching For the NamingService");


                try {
                        object =
orb.resolve_initial_references("NameService");
                }
                catch ( org.omg.CORBA.ORBPackage.InvalidName e) {

System.err.println("org.omg.CORBA.ORBPackage.InvalidName");
                    return;
                }

                System.err.println("NamingService Found");


                NamingContext root =
NamingContextHelper.narrow(object);

                // Resolve the object reference in naming
                //NameComponent nc = new NameComponent("test",
"my_context");
                //NameComponent nc2 = new NameComponent("Echo",
"Object");
                //NameComponent dspname[] = {nc, nc2};
                NameComponent dspname[] = new NameComponent[2];
                dspname[0] = new NameComponent("test", "my_context");
                dspname[1] = new NameComponent("Echo", "Object");


                System.err.println("Resolving...");


                try {
                    object = root.resolve(dspname);
                }
                catch (org.omg.CosNaming.NamingContextPackage.NotFound
e) {
                    System.err.println("NotFound");
                }
                catch
(org.omg.CosNaming.NamingContextPackage.CannotProceed
e) {
                    System.err.println("CannotProceed");
                }
                catch
(org.omg.CosNaming.NamingContextPackage.InvalidName e)
{
                        System.err.println("InvalidName");
                }


                System.err.println("Dispatcher Name resolved");
                 //dsp = Base.DispatcherHelper.narrow(object);
                Echo helloRef = EchoHelper.narrow(object);

            // Call the Hello server object and print results
            String hello = helloRef.echoString("Alessandro");
            System.out.println(hello);

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

        }
    }
}







_______________________________________________________
Say Bye to Slow Internet!
http://www.home.com/xinbox/signup.html