[omniORB] Java equivalent of omniORB.cfg - Java client C++ Server

Rajesh Khan rajeshkhan808 at gmail.com
Thu Dec 29 11:20:58 GMT 2011


Thanks for the reply Mark , however i am still unable to access the object.
My java code is

Properties props = new Properties();
props.put("org.omg.CORBA.ORBInitRef", "NameService=corbaname::XPA::2809");
ORB orb = ORB.init((String[])null, props);

// get the root naming context and obtain its address
 String names[] = orb.list_initial_services();
 org.omg.CORBA.Object objRef =
orb.resolve_initial_references("NameService");

  NamingContextExt ncRef ;
  ncRef = NamingContextExtHelper.narrow(objRef);

                //Location of object in naming service
                NamingContext rootContext = null;
                NameComponent nc[] = new NameComponent[1];
                nc[0]=new NameComponent("obj","obj");
                org.omg.CORBA.Object myobj =  rootContext.resolve(nc);  //
return null and breaks


//-----------------------------------------------------------------------------
                TestIntImpl = TestIntHelper.narrow(myobj); //If the object
had been located

*My C++ Server code is:*

CosNaming::NamingContextExt_
var rootContext;
// Obtain a reference to the root context of the Name service:
CORBA::Object_var obj;
obj = orb->resolve_initial_references("NameService");
rootContext = CosNaming::NamingContextExt::_narrow(obj);

        //Create a name called contextName
        CosNaming::Name contextName;
        contextName.length(1);
        contextName[0].id   =   (const char*) "obj";
        contextName[0].kind = (const char*) "obj";

        // Bind the context to root.
        rootContext->bind(contextName,objref); //objRef is an address to
the object that needs to be send

could u spot any faults ?? or any suggestions on how to resolve this issue
??

On Thu, Dec 29, 2011 at 11:05 AM, Mark Zimmerman <markzimm at frii.com> wrote:

> On Thu, Dec 29, 2011 at 06:41:02AM -0700, Rajesh Khan wrote:
> > Hi i am trying to get my java client to communicate with the C++ omniORB
> > server. I wanted to know is there a way to specify the naming service
> > address in java.
> > Like for example in C++ client we specify a config file having the
> > parameter:
> > *InitRef = NameService=corbaname::RemoteComputerName:2809/NameService*
> > I wanted to know what would its equivalent be in java.
> > I am only familiar with*
> > org.omg.CORBA.Object objRef =  orb.resolve_initial_references()*
> >
> > and tnameserv.exe which starts the java based naming server
>
> In the Properties object you pass to org.omg.CORBA.ORB.init, set this
> property:
>
> "org.omg.CORBA.ORBInitRef"
>
> to
>
> "NameService=corbaname::RemoteComputerName::2809"
>
> Or, use a command line argument.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20111229/5e58811c/attachment.htm


More information about the omniORB-list mailing list