[omniORB] Client in Java (Jacorb) and Server in C++ (OmniOrb)

Valter Henrique valter.bcc at gmail.com
Wed Nov 24 23:13:53 GMT 2010


Hi,
i'm trying, but i don't know where is my mistake here is my client in Java:

EchoClient.java
----------------------
import org.omg.CosNaming.*;
import org.omg.CORBA.*;

public class EchoClient {

    public static void main(String args[]) {
        try {
            String SetInfo, ReturnInfo, ref;
            org.omg.CORBA.Object objRef;
            Echo EchoRef;
            ORB orb = ORB.init(args, null);

            objRef = orb.resolve_initial_references("NameService");
            NamingContext ncRef = NamingContextHelper.narrow(objRef);

            // locate the service
            NameComponent nc =  new NameComponent("test", "my_context");
            NameComponent nc2 = new NameComponent("Echo", "Object");

            NameComponent path[] = { nc,nc2 };
            EchoRef = EchoHelper.narrow(ncRef.resolve(path));

            if (args.length > 1) {
                SetInfo = args[1];
            } else {

            }
            System.out.println("Client Process Begin: ");
            ReturnInfo = EchoRef.echoString("my corba test");
            System.out.println(ReturnInfo);
            */
        } catch (Exception e) {
            System.out.println("ERROR : " + e);
        }
    }
}
-------------------------------

When run the client :

java EchoClient -ORBInitialPort 2809

gives this error :
ERROR : org.omg.CosNaming.NamingContextPackage.NotFound: IDL:
omg.org/CosNaming/NamingContext/NotFound:1.0

Can anyone help me please?

Thanks for your attention.

Best regards,
Valter Henrique.

2010/11/24 Valter Henrique <valter.bcc at gmail.com>

> Sorry Duncan, but i don't understand what you say, i'm new in CORBA.
> Could you give me an example, please ?
>
> Thanks.
>
>
> 2010/11/24 Duncan Grisby <duncan at grisby.org>
>
> On Wed, 2010-11-24 at 05:55 -0800, Valter Henrique wrote:
>>
>> > i'm tryng do build a simple application using 'echo' example.
>> >
>> > I have my client in Java:
>>
>> [...]
>> >                       // locate the service
>> >                       NameComponent nc = new NameComponent("Echo", "");
>> >                       NameComponent path[] = { nc };
>> >                       EchoRef = EchoHelper.narrow(ncRef.resolve(path));
>>
>> [...]
>> > java EchoClient -ORBInitialPort 2809
>> > ERROR : org.omg.CosNaming.NamingContextPackage.NotFound:
>> > IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
>>
>> As the exception says, the name you have looked up is not found. The eg3
>> example uses the name test.my_context/Echo.Object . You need to either
>> create the two NameComponents separately, or use the
>> NamingContextExt::resolve_str method that will take the string form.
>>
>> Cheers,
>>
>> Duncan.
>>
>> --
>>  -- Duncan Grisby         --
>>  -- duncan at grisby.org     --
>>   -- http://www.grisby.org --
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20101124/dc006480/attachment.htm


More information about the omniORB-list mailing list