[omniORB] omniORB and Java

Wei Chen chenwei624 at yahoo.com
Sun Sep 14 01:21:28 BST 2003


I found in the earlier issues a question about omniORB
and Java interacoperations. One used the example Echo
comes with the download package. Following is the
Client in Java insted of the eg3_clt.

//////////////////////////////////////////////
import org.omg.CosNaming.*;
import org.omg.CORBA.*;
import java.util.Properties;

/**
 * This class is a client interface to the "echo"
example that comes with the
 * distribution of the omniORB examples.
 */
public class EchoClient
{
    public static void main(String args[])
    {
        try{
            // create and initialize the ORB
            ORB orb = ORB.init( args, null );
            // get the root naming context
            org.omg.CORBA.Object objRef =
orb.resolve_initial_references("NameService");
            NamingContext ncRef =
NamingContextHelper.narrow( objRef );
            System.out.println("Naming Service was
found successfully..." );
            // resolve the Object Reference in Naming:
            NameComponent nc1 = new NameComponent(
"test", "my_context");
            NameComponent nc = new NameComponent(
"Echo", "Object" );
            NameComponent path[] = {nc1, nc};

            System.out.println("About to find
Component...." );
            Echo echoRef = EchoHelper.narrow(
ncRef.resolve( path ) );

            // call the "ECHO" server object and print
results
            String msg;
            String hello;

           int i = 0;
           while( true )
           {
               msg = "Java Client ==>Hello: " + i++;
               hello = echoRef.echoString( msg );
               System.out.println( hello );
               Thread.sleep( 1000 );
           }

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

/////////////////////////////

I started the omniORB service on port 900 first (I've
also set the host, localhost, and the port 900 in
omniORB.cfg). Then I startet the server, eg3_impl. At
last I startet the Java client with:
   
   java EchoClient -ORBInitialPort 900

But I get the following error message:

ERROR: org.omg.CORBA.OBJECT_NOT_EXIST:   minor code:
1330446337  completed: No
org.omg.CORBA.OBJECT_NOT_EXIST:   minor code:
1330446337  completed: No
        at java.lang.Class.newInstance0(Native Method)
        at java.lang.Class.newInstance(Class.java:232)
        at
com.sun.corba.se.internal.iiop.ReplyMessage.getSystemException(ReplyM
essage.java:88)
        at
com.sun.corba.se.internal.iiop.ClientResponseImpl.getSystemException(
ClientResponseImpl.java:78)
        at
com.sun.corba.se.internal.corba.InitialNamingClient.resolve(InitialNa
mingClient.java:199)
        at
com.sun.corba.se.internal.corba.InitialNamingClient.cachedInitialRefe
rences(InitialNamingClient.java:260)
        at
com.sun.corba.se.internal.corba.InitialNamingClient.resolve_initial_r
eferences(InitialNamingClient.java:183)
        at
com.sun.corba.se.internal.corba.ORB.resolve_initial_references(ORB.ja
va:1456)
        at EchoClient.main(EchoClient.java:34)


It seems the client can't resolve the naming service
"NameService". I've read from the earlier issues that
this is maybe the problem of Sun JDK. Right?

Can someone give me a hand?

Regards

Wei


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



More information about the omniORB-list mailing list