[omniORB] how to set the argument "-ORBInitref" innamingservice on vxworksplatform

Tonny.W 747922371 at qq.com
Sat Jun 9 11:04:02 BST 2018


Mr Duncan Grisby
       Thank you for your reply. What I do is to port omniorb on the vxWorks system, include the name service. My step is as following :
      
       1. I create a project naming "omniNams". In the file of "omniNames.cc " ,part of my code is  as follows.Then I compile and run it as a thread in the target board:
       int vxNames_main(void){
         ....
          int argc = 5;
	  char *argv[5] = {""};
	  // Fill-in the port option
	  argv[1] = "-ORBendPoint";
	  argv[2] = "giop:tcp::2809";
	  argv[3] = "-ORBInitRef";
	  argv[4] = "NameService=corbaname:iiop:127.0.0.1:2809";

          orb = CORBA::ORB_init(argc, argv); 
          CORBA::Object_var poaref = orb->resolve_initial_references("RootPOA");
          PortableServer::POA_var poa = PortableServer::POA::_narrow(poaref);
          PortableServer::POAManager_var pman = poa->the_POAManager();
          CORBA::PolicyList pl(1);
          pl.length(1);
           pl[0] = poa->create_lifespan_policy(PortableServer::PERSISTENT);
           the_poa = poa->create_POA("", pman, pl);
          pman->activate();
         // Get the "magic" interoperable naming service POA
          poaref      = orb->resolve_initial_references("omniINSPOA");
         the_ins_poa = PortableServer::POA::_narrow(poaref);
         pman        = the_ins_poa->the_POAManager();
         pman->activate();    
         ..... 
       }
    2. I create a server side project naming "eg3_server". In the file of "eg3_impl.cc " ,part of my code is  as follows.Then I compile and run it  in the target board:
       int server_main(int argc, char **argv)
       {
         ...
       
            CORBA::ORB_var          orb = CORBA::ORB_init(argc, argv);
            CORBA::Object_var       obj = orb->resolve_initial_references("RootPOA");
            PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
            PortableServer::Servant_var<Echo_i> myecho = new Echo_i();
           PortableServer::ObjectId_var myechoid = poa->activate_object(myecho);
           obj = myecho->_this();
            
            CORBA::Object_var obj = orb->resolve_initial_references("NameService");
           CosNaming::NamingContext_var  rootContext = CosNaming::NamingContext::_narrow(obj);
             .....
 
       }
    3. My question is  that it throw a exception of "Caught CORBA::OBJECT_NOT_EXIST" ,when excute the code " CosNaming::NamingContext_var  rootContext = CosNaming::NamingContext::_narrow(obj);"
    4. My code can run successfully on windows, but it  throw the  exception in step 3. With the help of debug mode, I discover something interesting:
       In windows, the function call as following:
      (1) CosNaming::NamingContext::_narrow(::CORBA::Object_ptr obj)  in the file of "NamingSk.cc"
      (2) omniObjRef::_realNarrow(const char* repoId)  in the file of  " omniObjRef.cc"
      (3) omniObjRef::_real_is_a(const char* repoId)  in the file  of " omniObjRef.cc"
      (4) omniObjRef::_remote_is_a(const char* a_repoId)    in the file  of " omniObjRef.cc"
      (5) omniObjRef::_invoke(omniCallDescriptor& call_desc, CORBA::Boolean do_assert) in the file of "omniObjRef.cc"
      (6) omniRemoteIdentity::dispatch(omniCallDescriptor& call_desc) in the file  of " remoteIdentity.cc"
     However,in vxworks, the function callas following:
     (1) CosNaming::NamingContext::_narrow(::CORBA::Object_ptr obj)  in the file of "NamingSk.cc"
      (2) omniObjRef::_realNarrow(const char* repoId)  in the file of  " omniObjRef.cc"
      (3) omniObjRef::_real_is_a(const char* repoId)  in the file  of " omniObjRef.cc"
      (4) omniObjRef::_remote_is_a(const char* a_repoId)    in the file  of " omniObjRef.cc"
      (5) omniObjRef::_invoke(omniCallDescriptor& call_desc, CORBA::Boolean do_assert) in the file of "omniObjRef.cc"
      (6) omniInProcessIdentity::dispatch(omniCallDescriptor& call_desc)in the file  of " inProcessIdentity.cc"
    
     The difference is that  the (5)function  calls different funtion in the (6) funtion ,I don't know why.
     The exception of "Caught CORBA::OBJECT_NOT_EXIST" occurs in (6) funtion in vxworks.
        
------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20180609/3c6aa0fb/attachment.html>


More information about the omniORB-list mailing list