[omniORB] error in 'bind_new_context'

ondrej at frcatel.fri.utc.sk ondrej at frcatel.fri.utc.sk
Wed Feb 4 06:13:15 GMT 2004


> Hi all,
> I am using omnbORB-4.0.3 in windows 2000. I have
> written a c++ app very similar to the one in eg3_Impl
> (example 3 echo server) provided in the distribution,
> which fails on 'bind_new_context' call. Note that
> example 3 works fine.
> The code is attached:
>
> CORBA::Boolean TheOrb::bindObjectToName(std::string
> name, CORBA::Object_ptr objRef)
> {
>   CosNaming::NamingContext_var rootContext;
>
>   try
>     {
>       /* orb as define in a included header file as
> CORBA::ORB_var                 orb; */

In my opinion, placing orb variable into try..catch is not a good idea,
because when the execution comes out of the scope (e.g. leaves try-catch
block), the orb variable gets destroyed and it will probably shut down
your ORB. However, it is always a good idea to call ORB_init() _before_
you start doing your CORBA calls.

So the lines above should look like:

CORBA::ORB_var orb;
orb = CORBA::ORB_init(argc,argv,"omniORB4");

try
{
.....
}

		With regards

				Ondrej



More information about the omniORB-list mailing list