[omniORB] Beginner's question about corbaloc
Wernke zur Borg
wzb at anitesystems.de
Thu Nov 11 15:05:58 GMT 2004
Hi Jörg,
your problem is that you start the server with a random port number. Your
client tries to reach the server under the default port which is 2809.
Start the server with a endpoint specification, e.g. giop:tcp::<port> and
use the corbaloc with that port number, e.g.
corbaloc::localhost:<port>/POAtest
Hope it helps,
Wernke
-----Original Message-----
From: omniorb-list-bounces at omniorb-support.com
[mailto:omniorb-list-bounces at omniorb-support.com] On Behalf Of Jörg König
Sent: 11 November 2004 13:12
To: omniorb-list at omniorb-support.com
Subject: [omniORB] Beginner's question about corbaloc
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
_______________________________________________
omniORB-list mailing list
omniORB-list at omniorb-support.com
http://www.omniorb-support.com/mailman/listinfo/omniorb-list
More information about the omniORB-list
mailing list