[omniORB] Persistent Reference not working...

baileyk@schneider.com baileyk@schneider.com
Thu Oct 17 13:59:01 2002


I haven't done much with persistent references, but my understanding is
that if the server stops gracefully it should notify all clients with open
connections to close them.  Thereafter, if the client does another method
call then the client orb should silently reconnect.  Are you stopping your
server with shutdown() ?  or just killing it with a signal?  If
orb->shutdown() is called, then I'm suprised the clients are getting an
exception after the server comes back up.  If not, then it's likely proper
behavior and the client will need to retry after the exception (should be
no need to retrieve the obj reference from the name service again).

Kendall



                                                                                                                            
                    Diego Sánchez-Aparisi                                                                                   
                    <dsam@tid.es>                      To:     "SI - Alberto \(Trabajo\)" <alberto.caballero@invensys.com>, 
                    Sent by:                            "SI - Edu \(TID\)" <ebas@tid.es>, "SI- Lista OmniORB"               
                    omniorb-list-admin@omniorb-s        <omniORB-list@omniorb-support.com>                                  
                    upport.com                         cc:                                                                  
                                                       Fax to:                                                              
                                                       Subject:     [omniORB] Persistent Reference not working...           
                    10/17/2002 06:25 AM                                                                                     
                                                                                                                            
                                                                                                                            




Hello everybody

I tried your suggestions about the launching of the server with the
-ORBendPoint option and it seems it works fine (the server gets the same
IOR in each execution). But the problem now is that the client (if the
server is suhtdown/restart between times) gets an execption with its server
reference, that is, if I shutdown&restart the server between two client
calls(with the same reference), the second one gets and exception in the
client side. That means that the reference that the client is getting in
order to access the server is not PERISTENT. Notice that the server gets
subscribed into de NamingService and the client gets its reference from
that NamingService.

I attach the server code. I someone can take a look to the code, maybe I
forgot something important....
The option I used for launching the server is:

./echo_i -ORBendPoint giop:tcp:127.0.0.1:8888



int main(int argc, char** argv)
{
    try
    {
        // Initialise the ORB.
        CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
        //Hacemos los del POA con USER_ID. Pag 66 del manual de OMNI
        CORBA::Object_var obj2 = orb -> resolve_initial_references
("omniINSPOA");
        PortableServer::POA_var poa2 = PortableServer::POA::_narrow(obj2);
        PortableServer::POAManager_var pman = poa2->the_POAManager();

        Echo_i* myecho = new Echo_i();
        PortableServer::ObjectId_var oid =
PortableServer::string_to_ObjectId("EchoPOA");

        poa2->activate_object_with_id(oid,myecho);
        CORBA::Object_var echoObj = poa2->id_to_reference(oid.in());

        CORBA::String_var x = orb->object_to_string(echoObj);
        cout<<"IOR:"<<x<<endl;
        if (!bindObjectToName(orb,echoObj))
            return 1;

        pman->activate();
        orb->run();
    }
    catch(CORBA::SystemException&)
    {
        cerr << "Caught CORBA::SystemException." << endl;
    }
    catch(CORBA::Exception&)
    {
        cerr << "Caught CORBA::Exception." << endl;
    }
   catch(omniORB::fatalException& fe)
    {
        cerr << "Caught omniORB::fatalException:" << endl;
        cerr << " file: " << fe.file() << endl;
        cerr << " line: " << fe.line() << endl;
        cerr << " mesg: " << fe.errmsg() << endl;
    }
    catch(...)
    {
        cerr << "Caught unknown exception." << endl;
    }
return 0;
}

Regards
Diego