On Thu, 20 Jul 2006, [EMAIL PROTECTED] wrote:

??????


Hello, I am developing a distributed application using CORBA.

My client application  in aix 5.2.0.0 works properly when the server
application  is up . The server application  run on windows.

If the server is down, then run the client app and get the following:

"

uncaught MICO exception: IDL:omg.org/CORBA/COMM_FAILURE:1.0 (0,
not-completed)
IOT/Abort trap(coredump)

"

In my prougramm the functions is :

int
lookup()
{
   // ORB initialization
   CORBA::ORB_var orb = CORBA::ORB_init(num, opt);

   // Acquire a reference to the Naming Service
   CORBA::Object_var nsobj =
orb->resolve_initial_references("NameService");
   CosNaming::NamingContext_var nc =
CosNaming::NamingContext::_narrow(nsobj);

   if(CORBA::is_nil(nc))
   {
       cerr << "oops, I cannot access the Naming Service!" << endl;
       return(-1);
   }

   // Construct Naming Service name
   CosNaming::Name name;
   name.length(1);
   name[0].id = CORBA::string_dup("upSendMsg");    // "upSendMsg" is the
name of Naming Service
   name[0].kind = CORBA::string_dup("");

   // try to find that node in the Naming Service tree
   CORBA::Object_var obj;

#ifdef HAVE_EXCEPTIONS
   try
   {
       obj = nc->resolve(name);
   }
   catch(CosNaming::NamingContext::NotFound &exc)
   {
       cout << "NotFound exception." << endl;
       return(-1);
   }
   catch(CosNaming::NamingContext::CannotProceed &exc)
   {
       cout << "CannotProceed exception." << endl;
       return(-1);
   }
   catch (CosNaming::NamingContext::InvalidName &exc)
   {
       cout << "InvalidName exception." << endl;
       return(-1);
   }
   catch (CosNaming::NamingContext::AlreadyBound &exc)
   {
       cout << "AlreadyBound exception." << endl;
       return(-1);
   }
   catch (CosNaming::NamingContext::NotEmpty &exc)
   {
       cout << "NotEmpty exception." << endl;
       return(-1);
   }
   catch (...)
   {
       cerr << "Cannot find EventChannel !" << endl;
       cout << "Cannot find EventChannel !" << endl;
       return(-1);
   }
#else
   obj = nc->resolve(name);
   wcout<<"here is "<<endl;
#endif

   wcout<<"here is "<<endl;

   // The Naming Service returns a generic reference as a CORBA::Object
   // We need to narrow this to the desired type
   up = UpSendMsgInterface::_narrow(obj);
   return( 0 );
}
================================================================================
My question is why the client can not catch exception when the server is
not up .

The problem is that you have not guarded by try/catch block all possible remote calls done by your code snipped above. Please note that _narrow also causes remote invocation.

Cheers,
Karel
--
Karel Gardas                  [EMAIL PROTECTED]
ObjectSecurity Ltd.           http://www.objectsecurity.com
---
Need experienced, fast, reliable technical MICO support?
---> http://www.objectsecurity.com/mico_commsup_referral.html <---
---
_______________________________________________
Mico-devel mailing list
[email protected]
http://www.mico.org/mailman/listinfo/mico-devel

Reply via email to