[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> </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 is, if I shutdown&restart 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> </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> </DIV>
<DIV>./echo_i -ORBendPoint giop:tcp:127.0.0.1:8888</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>int main(int argc, char** argv)</DIV>
<DIV>{</DIV>
<DIV> try </DIV>
<DIV> {</DIV>
<DIV> // Initialise the ORB.</DIV>
<DIV> CORBA::ORB_var orb =3D=20
CORBA::ORB_init(argc, argv);</DIV>
<DIV> //Hacemos los del POA con =
USER_ID.=20
Pag 66 del manual de OMNI</DIV>
<DIV> CORBA::Object_var obj2 =3D =
orb ->=20
resolve_initial_references("omniINSPOA");</DIV>
<DIV> PortableServer::POA_var poa2 =
=3D=20
PortableServer::POA::_narrow(obj2); </DIV>
<DIV> =
PortableServer::POAManager_var pman =3D=20
poa2->the_POAManager();</DIV>
<DIV> </DIV>
<DIV> Echo_i* myecho =3D new =
Echo_i();</DIV>
<DIV> PortableServer::Obje=
ctId_var=20
oid =3D PortableServer::string_to_ObjectId("EchoPOA");</DIV>
<DIV> </DIV>
<DIV> =20
poa2->activate_object_with_id(oid,myecho);</DIV>
<DIV> CORBA::Object_var echoObj =3D =
poa2->id_to_reference(oid.in());</DIV>
<DIV> </DIV>
<DIV> CORBA::String_var x =3D=20
orb->object_to_string(echoObj);</DIV>
<DIV> =20
cout<<"IOR:"<<x<<endl;</DIV>
<DIV> if=20
(!bindObjectToName(orb,echoObj))</DIV>
<DIV> return =
1;</DIV>
<DIV> </DIV>
<DIV> pman->activate();</DIV>
<DIV> orb->run();</DIV>
<DIV> }</DIV>
<DIV> catch(CORBA::SystemException&) </DIV>
<DIV> {</DIV>
<DIV> cerr << "Caught=20
CORBA::SystemException." << endl; </DIV>
<DIV> }</DIV>
<DIV> catch(CORBA::Exception&) </DIV>
<DIV> {</DIV>
<DIV> cerr << "Caught=20
CORBA::Exception." << endl;</DIV>
<DIV> }</DIV>
<DIV> catch(omniORB::fatalException& fe) </DIV>
<DIV> {</DIV>
<DIV> cerr << "Caught=20
omniORB::fatalException:" << endl;</DIV>
<DIV> cerr << " file: " =
<<=20
fe.file() << endl;</DIV>
<DIV> cerr << " line: " =
<<=20
fe.line() << endl;</DIV>
<DIV> cerr << " mesg: " =
<<=20
fe.errmsg() << endl;</DIV>
<DIV> }</DIV>
<DIV> catch(...) </DIV>
<DIV> {</DIV>
<DIV> cerr << "Caught unknown =
exception." << endl;</DIV>
<DIV> }</DIV>
<DIV>return 0;</DIV>
<DIV>}</DIV>
<DIV> </DIV>
<DIV>Regards</DIV>
<DIV>Diego</DIV></FONT></FONT></BODY></HTML>
------=_NextPart_000_015B_01C275E0.BA64AF80--