AW: [omniORB] problem with registering a servant at te Name Servi ce

Hopfes, Harald Harald.Hopfes.Hopfes@sysde.eads.net
Tue Aug 13 14:17:01 2002


Hi!

I use the following code. It might help you:

Harald

------------------------------------------------------------------
  int nrOfTransientExceptions = 0;
  CosNaming::NamingContext_var tContext;
  while (true) {
    try {
      tContext = CosNaming::NamingContext::_narrow(obj.in());
      break;
    } catch (const CORBA::COMM_FAILURE &ex) {
      cerr << "NamingContext::_narrow had COMM_FAILURE" << endl;
      throw;
    } catch (const CORBA::OBJECT_NOT_EXIST &ex) {
      cerr << "NamingContext::_narrow had CORBA::OBJECT_NOT_EXIST" << endl;
      throw;
    } catch (const CORBA::TRANSIENT &ex) {
      cerr << "NamingContext::_narrow had CORBA::TRANSIENT" << endl;
      nrOfTransientExceptions++;
      if (nrOfTransientExceptions >= 5) throw;
      sleep(2);
      continue;
    }
  }
------------------------------------------------------------------

> -----Ursprüngliche Nachricht-----
> Von: I Q [mailto:wing_4711@yahoo.de]
> Gesendet: Freitag, 9. August 2002 13:31
> An: omniorb-list@realvnc.com
> Betreff: [omniORB] problem with registering a servant at te 
> Name Service
> 
> 
> Hello everybody,
> 
> I have a problem getting the servant registered at the
> Name Service.
> 
> This problems already arises in the example
> eg3_tieimpl:
> 
> I have set omniORB.cfg as described and have set the
> environment variable OMNIORB_CONFIG accordingly, but
> the example didn't run.
> 
> I have added some output in order to figure out where
> the programme crashes:
> 
> 
> >>>>>>>>>>
> static CORBA::Boolean
> bindObjectToName(CORBA::ORB_ptr orb, CORBA::Object_ptr
> objref)
> {
>   CosNaming::NamingContext_var rootContext;
> 
>   try {
>     // Obtain a reference to the root context of the
> Name service:
>     CORBA::Object_var obj;
>     obj =
> orb->resolve_initial_references("NameService");
>     cout <<"before narrow" << endl;
>     // Narrow the reference returned.
>     rootContext =
> CosNaming::NamingContext::_narrow(obj);
>     cout <<"after narrow" << endl;
>     if( CORBA::is_nil(rootContext) ) {
>       cerr << "Failed to narrow the root naming
> context." << endl;
>       return 0;
>     }
>   }
>   catch(CORBA::ORB::InvalidName& ex) {
>     // This should not happen!
>     cerr << "Service required is invalid [does not
> exist]." << endl;
>     return 0;
>   }
> 
> <<<<<<<<<<<<<<
> 
> This is the programme's output:
> 
> >>>>>>>>>>>>>>
> [echo] $eg3_tieimpl
> before narrow
> omniORB: ERROR -- A servant has been deleted that is
> still activated.
>       id: root<0>
> Caught CORBA::SystemException.
> [echo] $
> <<<<<<<<<<<<<<
> 
> 
> i.e. the crash arises at the attempt of narrowing the
> reference at line:
> rootContext = CosNaming::NamingContext::_narrow(obj);
> 
> 
> 
> Wing
> 
> __________________________________________________________________
> 
> Gesendet von Yahoo! Mail - http://mail.yahoo.de
> Möchten Sie mit einem Gruß antworten? http://grusskarten.yahoo.de
> _______________________________________________
> omniORB-list mailing list
> omniORB-list@realvnc.com
> http://www.realvnc.com/mailman/listinfo/omniorb-list
>