[omniORB] Beginner's question about corbaloc
Jörg König
J.Koenig at adg.de
Thu Nov 11 13:12:08 GMT 2004
Hi,
My name is Jörg. I'm new to this mailing list. My native language is
german, so forgive me if my english isn't the best :)
Now for the problem: Until now I used omniORB 2.8 for a very long time
and thought it would be time to upgrade to a somewhat newer version. So
far I used the BOA model in conjunction with a NameService for a set of
Servers. Now I need to develop a server that can be contacted without
the need of a NameService and thought the "corbaloc" could solve my problem.
I tried omniORB 4.0.5 and wrote a very simple server/client application
to see how it works. The interface is as simple as the echo-sample that
comes with omniORB. My server's main() looks like this (all error
handling stripped off, because the debugger does the work, too :-) ):
int main(int argc, char ** argv)
{
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
CORBA::Object_var obj = orb->resolve_initial_references("omniINSPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
poa->the_POAManager()->activate();
IEcho * echo = new IEcho();
PortableServer::ObjectId_var oid =
PortableServer::string_to_ObjectId("POAtest");
PortableServer::ServantBase_var servant = echo;
poa->activate_object_with_id(oid, servant);
Echo_var v = echo->_this();
echo->_remove_ref();
cout << "Server is ready" << endl;
orb->run();
return 0;
}
The client side looks like this:
int main(int argc, char ** argv) {
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
CORBA::String_var strIOR =
CORBA::string_dup("corbaloc::localhost:/POAtest");
CORBA::Object_ptr obj = orb->string_to_object(strIOR);
Echo_var v = Echo::_narrow(obj); // this will throw an exception
cout << v->send("Hello Server") << endl;
orb->destroy();
return 0;
}
(I'm not giving any arguments (argc/argv) to either the server or client.)
Unfortunataly the client doesn't work as expected. As soon as I try to
narrow the object to its real type, the ORB throws a TRANSIENT exception.
I think I'm missing something, but cannot figure out what it is...
Hope someone can enlighten me :)
Jörg
--
Mail: J.Koenig at adg.de
Company: ADG mbH, Mannheim Germany
Phone: +49 0621/8505-609
More information about the omniORB-list
mailing list