[omniORB] SystemException on resolve_initial_references

Rama rrach001 at fiu.edu
Fri Oct 3 03:45:18 BST 2003


  
 I always get a SystemException on 
 CORBA::Object_var obj = orb->resolve_initial_references("NameService");
 
 I have attached my OmniOrb.cfg and the cpp file, Please let me know if i am doing anything wrong?
 
 Thanks,
 Rama

-------------- next part --------------
A non-text attachment was scrubbed...
Name: omniORB.cfg
Type: application/octet-stream
Size: 32694 bytes
Desc: not available
Url : http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20031003/490772b7/omniORB-0001.obj
-------------- next part --------------

     CORBA::ORB_var orb=CORBA::ORB::_nil(); // create nil references
	
	 VtsSoaApi::LogonReq logonReq;

 try{
    	 orb=CORBA::ORB_init(argc,NULL,"");
	 }catch ( CORBA::Exception &ex)
	 {
       MessageBox("Could not Initialize the ORB","Error",MB_ICONSTOP | MB_OK);

	 }
	  

	
     try{
	
		 
		
		  CORBA::Object_var obj = orb->resolve_initial_references("NameService");
	
		 CosNaming::NamingContext_var rootContext;
		 rootContext=CosNaming::NamingContext::_narrow(obj);
		  
		 if (CORBA::is_nil(rootContext)){
          MessageBox("Cannot narrow references to type NameContext","Error",MB_ICONSTOP | MB_OK);
		  orb->destroy();
		  return;

		 } 
		 
		 VtsSoaApi::VtsSoaConnectionFactory_var connectionRef=VtsSoaApi::VtsSoaConnectionFactory::_narrow(obj);
          

		 if (CORBA::is_nil(connectionRef))
		 {
            MessageBox("Cannot narrow references to type NameContext","Error",MB_ICONSTOP | MB_OK);

      	 }
	
		
		logonReq.sop=CORBA::string_dup("Test");
        logonReq.password=CORBA::string_dup("Test");
      	m_VtsSoaConnection=connectionRef->logon(logonReq);


	 }catch(CORBA::COMM_FAILURE& ex) {
		 MessageBox("Caught system exception COMM_FAILURE -- unable to contact the object ","Error",MB_ICONSTOP | MB_OK);
	 }
  	  catch(CORBA::SystemException&) {
		MessageBox("Caught CORBA::SystemException.","Error",MB_ICONSTOP | MB_OK);
	  }
	  catch(CORBA::Exception&) {
		MessageBox("Caught CORBA::Exception.","Error",MB_ICONSTOP | MB_OK);
	  }
	  //catch(omniORB::fatalException& fe) {
	  catch(omniORB::fatalException& ) {
		//MessageBox("Caught omniORB::fatalException: file:" fe.file() + "line:" fe.line() + "mesg:" + fe.errmsg(),"Error",MB_ICONSTOP | MB_OK);
		MessageBox("Caught omniORB::fatalException: file:", "Error",MB_ICONSTOP | MB_OK);
	  }
	  catch(...) {
		MessageBox("Caught unknown exception","Error",MB_ICONSTOP | MB_OK);
	  }


	orb->destroy();

}



More information about the omniORB-list mailing list