[omniORB] Persistent Reference not working...

Diego Sánchez-Aparisi dsam@tid.es
Thu Oct 17 12:22:00 2002


This is a multi-part message in MIME format.

------=_NextPart_000_015B_01C275E0.BA64AF80
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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=20
    {
        // Initialise the ORB.
        CORBA::ORB_var orb =3D CORBA::ORB_init(argc, argv);
        //Hacemos los del POA con USER_ID. Pag 66 del manual de OMNI
        CORBA::Object_var obj2 =3D orb -> =
resolve_initial_references("omniINSPOA");
        PortableServer::POA_var poa2 =3D =
PortableServer::POA::_narrow(obj2);=20
        PortableServer::POAManager_var pman =3D poa2->the_POAManager();

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

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

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

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

Regards
Diego

------=_NextPart_000_015B_01C275E0.BA64AF80
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2716.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff><FONT face=3DArial size=3D2><FONT size=3D2>
<DIV>Hello everybody</DIV>
<DIV>&nbsp;</DIV>
<DIV>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=20
each execution). But the problem now is that the client (if the server =
is=20
suhtdown/restart between times) gets an execption with its server =
reference,=20
that&nbsp;is, if&nbsp;I shutdown&amp;restart&nbsp;the server between two =
client=20
calls(with the same reference), the second one gets and exception in the =
client=20
side. That means that the reference that the client is getting in order =
to=20
access the server is not PERISTENT. Notice that the server gets =
subscribed into=20
de NamingService and the client gets its reference from that=20
NamingService.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I attach the server code. I someone can take a look to the code, =
maybe I=20
forgot something important....</DIV>
<DIV>The option I used for launching the server is:</DIV>
<DIV>&nbsp;</DIV>
<DIV>./echo_i -ORBendPoint giop:tcp:127.0.0.1:8888</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>int main(int argc, char** argv)</DIV>
<DIV>{</DIV>
<DIV>&nbsp;&nbsp;&nbsp; try </DIV>
<DIV>&nbsp;&nbsp;&nbsp; {</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Initialise the ORB.</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CORBA::ORB_var orb =3D=20
CORBA::ORB_init(argc, argv);</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Hacemos los del POA con =
USER_ID.=20
Pag 66 del manual de OMNI</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CORBA::Object_var obj2 =3D =
orb -&gt;=20
resolve_initial_references("omniINSPOA");</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PortableServer::POA_var poa2 =
=3D=20
PortableServer::POA::_narrow(obj2); </DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
PortableServer::POAManager_var pman =3D=20
poa2-&gt;the_POAManager();</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Echo_i* myecho =3D new =
Echo_i();</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PortableServer::Obje=
ctId_var=20
oid =3D PortableServer::string_to_ObjectId("EchoPOA");</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
poa2-&gt;activate_object_with_id(oid,myecho);</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CORBA::Object_var echoObj =3D =

poa2-&gt;id_to_reference(oid.in());</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CORBA::String_var x =3D=20
orb-&gt;object_to_string(echoObj);</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
cout&lt;&lt;"IOR:"&lt;&lt;x&lt;&lt;endl;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if=20
(!bindObjectToName(orb,echoObj))</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return =
1;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pman-&gt;activate();</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; orb-&gt;run();</DIV>
<DIV>&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>&nbsp;&nbsp;&nbsp; catch(CORBA::SystemException&amp;) </DIV>
<DIV>&nbsp;&nbsp;&nbsp; {</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cerr &lt;&lt; "Caught=20
CORBA::SystemException." &lt;&lt; endl;&nbsp;&nbsp;&nbsp; </DIV>
<DIV>&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>&nbsp;&nbsp;&nbsp; catch(CORBA::Exception&amp;) </DIV>
<DIV>&nbsp;&nbsp;&nbsp; {</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cerr &lt;&lt; "Caught=20
CORBA::Exception." &lt;&lt; endl;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>&nbsp;&nbsp; catch(omniORB::fatalException&amp; fe) </DIV>
<DIV>&nbsp;&nbsp;&nbsp; {</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cerr &lt;&lt; "Caught=20
omniORB::fatalException:" &lt;&lt; endl;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cerr &lt;&lt; " file: " =
&lt;&lt;=20
fe.file() &lt;&lt; endl;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cerr &lt;&lt; " line: " =
&lt;&lt;=20
fe.line() &lt;&lt; endl;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cerr &lt;&lt; " mesg: " =
&lt;&lt;=20
fe.errmsg() &lt;&lt; endl;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>&nbsp;&nbsp;&nbsp; catch(...) </DIV>
<DIV>&nbsp;&nbsp;&nbsp; {</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cerr &lt;&lt; "Caught unknown =

exception." &lt;&lt; endl;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;}</DIV>
<DIV>return 0;</DIV>
<DIV>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>Regards</DIV>
<DIV>Diego</DIV></FONT></FONT></BODY></HTML>

------=_NextPart_000_015B_01C275E0.BA64AF80--