<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"Pr\00E9format\00E9 HTML Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.PrformatHTMLCar
        {mso-style-name:"Pr\00E9format\00E9 HTML Car";
        mso-style-priority:99;
        mso-style-link:"Pr\00E9format\00E9 HTML";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span lang=FR>Hi,<o:p></o:p></span></p><p class=MsoNormal><span lang=FR><o:p>&nbsp;</o:p></span></p><p class=MsoNormal>I&#8217;m working with omniORB 4.1.7, and I try to use the NameService, but somehow I fail completely to implement my server.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Here&#8217;s my server code:<o:p></o:p></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CORBA::Object_ptr&nbsp;poaObj&nbsp;=&nbsp;orb-&gt;resolve_initial_references(</span><span style='font-size:10.0pt;font-family:Consolas;color:#A31515'>&quot;RootPOA&quot;</span><span style='font-size:10.0pt;font-family:Consolas;color:black'>);<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PortableServer::POA_ptr&nbsp;rootPOA&nbsp;=&nbsp;PortableServer::POA::_narrow(poaObj);<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'> <o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PortableServer::POAManager_ptr&nbsp;manager&nbsp;=&nbsp;rootPOA-&gt;the_POAManager(); </span><span style='font-size:10.0pt;font-family:Consolas;color:green'>//&nbsp;get&nbsp;the&nbsp;POA&nbsp;Manager</span><span style='font-size:10.0pt;font-family:Consolas;color:black'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:Consolas;color:green'>//&nbsp;Activate&nbsp;the&nbsp;servant</span><span style='font-size:10.0pt;font-family:Consolas;color:black'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Tests&nbsp;*&nbsp;servant&nbsp;=&nbsp;</span><span style='font-size:10.0pt;font-family:Consolas;color:blue'>new</span><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;Tests();<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rootPOA-&gt;activate_object(servant);<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HeapTests_ptr&nbsp;server&nbsp;=&nbsp;servant-&gt;_this();<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; servant-&gt;_remove_ref();<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'> <o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:Consolas;color:green'>//&nbsp;get&nbsp;a&nbsp;reference&nbsp;to&nbsp;the&nbsp;naming&nbsp;service</span><span style='font-size:10.0pt;font-family:Consolas;color:black'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CORBA::Object_ptr&nbsp;serviceObj&nbsp;=&nbsp;orb-&gt;resolve_initial_references(</span><span style='font-size:10.0pt;font-family:Consolas;color:#A31515'>&quot;NameService&quot;</span><span style='font-size:10.0pt;font-family:Consolas;color:black'>);<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CosNaming::NamingContextExt_ptr&nbsp;namingContext&nbsp;=&nbsp;CosNaming::NamingContextExt::_narrow(serviceObj);<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CosNaming::Name&nbsp;*&nbsp;servantName&nbsp;=&nbsp;namingContext-&gt;to_name(</span><span style='font-size:10.0pt;font-family:Consolas;color:#A31515'>&quot;TestsServer&quot;</span><span style='font-size:10.0pt;font-family:Consolas;color:black'>);<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'> <o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CORBA::Object_ptr&nbsp;servantRef&nbsp;=&nbsp;rootPOA -&gt;servant_to_reference(servant);<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; namingContext-&gt;rebind(*servantName,&nbsp;servantRef);<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'> <o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout&nbsp;&lt;&lt;&nbsp;orb-&gt;object_to_string(server)&nbsp;&lt;&lt;&nbsp;std::endl;<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'> <o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; manager-&gt;activate(); </span><span style='font-size:10.0pt;font-family:Consolas;color:green'>//&nbsp;Activate&nbsp;the&nbsp;POA&nbsp;Manager</span><span style='font-size:10.0pt;font-family:Consolas;color:black'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'> <o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout&nbsp;&lt;&lt;&nbsp;</span><span style='font-size:10.0pt;font-family:Consolas;color:#A31515'>&quot;Pretty&nbsp;much&nbsp;a&nbsp;success&nbsp;!&quot;</span><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&lt;&lt;&nbsp;std::endl;<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'> <o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:green'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;Internal test, this one works perfectly<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CORBA::Object_ptr&nbsp;serverObj&nbsp;=&nbsp;namingContext-&gt;resolve_str(</span><span style='font-size:10.0pt;font-family:Consolas;color:#A31515'>&quot;TestsServer&quot;</span><span style='font-size:10.0pt;font-family:Consolas;color:black'>);<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HeapTests_var&nbsp;distantServer&nbsp;=&nbsp;HeapTests::_narrow(serverObj);<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'> <o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CORBA::String_var&nbsp;str;<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'> <o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; distantServer-&gt;strout(str);<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'> <o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout&nbsp;&lt;&lt;&nbsp;str._retn()&nbsp;&lt;&lt;&nbsp;std::endl;<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'> <o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; orb-&gt;run(); </span><span style='font-size:10.0pt;font-family:Consolas;color:green'>//&nbsp;Wait&nbsp;for&nbsp;incoming&nbsp;requests</span><span style='font-size:10.0pt;font-family:Consolas;color:black'><o:p></o:p></span></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>The test done on the server side using the NameService works correctly. However, when I use another exe to do the exact same test, my server crashes with an access violation in the dispatcher<o:p></o:p></p><p class=MsoNormal>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; omniORB417_vc10_rtd.dll!omni::GIOP_S::dispatcher()&nbsp; Line 279 + 0x8 bytes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C++<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Is there any problem with my implementation or anything which can cause this exception ?<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Thanks<o:p></o:p></p><p class=MsoNormal>Nicolas.<o:p></o:p></p></div></body></html>