[omniORB] Beginner's question about corbaloc
Jochen Behrens
jochen.behrens at barco.com
Thu Nov 11 14:32:07 GMT 2004
Hi Jörg,
the port information in the URI is missing. The correct form of the URI is:
corbaloc:iiop:<host>:<port>/<object key> (see also section 6.1 of the
omniORB User's Guide)
You should change your client implementation for example as follows:
...
CORBA::String_var strIOR =
CORBA::string_dup("corbaloc::localhost:*4711*/POAtest");
CORBA::Object_ptr obj = orb->string_to_object(strIOR);
...
and start the server with the corresponding endpoint parameter:
> server -ORBendPoint giop:tcp::*4711*
Best Regards,
Jochen
Jörg König wrote:
> 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
> - - - - - - - DISCLAIMER - - - - - - - -
> Unless indicated otherwise, the information contained in this message
> is privileged and confidential, and is intended only for the use of
> the addressee(s) named above and others who have been specifically
> authorized to receive it. If you are not the intended recipient, you
> are hereby notified that any dissemination, distribution or copying of
> this message and/or attachments is strictly prohibited. The company
> accepts no liability for any damage caused by any virus transmitted by
> this email. Furthermore, the company does not warrant a proper and
> complete transmission of this information, nor does it accept
> liability for any delays. If you have received this message in error,
> please contact the sender and delete the message. Thank you.
>
More information about the omniORB-list
mailing list