<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> </o:p></span></p><p class=MsoNormal>I’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> </o:p></p><p class=MsoNormal>Here’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> </o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'> CORBA::Object_ptr poaObj = orb->resolve_initial_references(</span><span style='font-size:10.0pt;font-family:Consolas;color:#A31515'>"RootPOA"</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'> PortableServer::POA_ptr rootPOA = 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'> PortableServer::POAManager_ptr manager = rootPOA->the_POAManager(); </span><span style='font-size:10.0pt;font-family:Consolas;color:green'>// get the POA 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'> </span><span style='font-size:10.0pt;font-family:Consolas;color:green'>// Activate the 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'> Tests * servant = </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'> Tests();<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'> rootPOA->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'> HeapTests_ptr server = servant->_this();<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'> servant->_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'> </span><span style='font-size:10.0pt;font-family:Consolas;color:green'>// get a reference to the naming 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'> CORBA::Object_ptr serviceObj = orb->resolve_initial_references(</span><span style='font-size:10.0pt;font-family:Consolas;color:#A31515'>"NameService"</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'> CosNaming::NamingContextExt_ptr namingContext = 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'> CosNaming::Name * servantName = namingContext->to_name(</span><span style='font-size:10.0pt;font-family:Consolas;color:#A31515'>"TestsServer"</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'> CORBA::Object_ptr servantRef = rootPOA ->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'> namingContext->rebind(*servantName, 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'> std::cout << orb->object_to_string(server) << 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'> manager->activate(); </span><span style='font-size:10.0pt;font-family:Consolas;color:green'>// Activate the POA 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'> std::cout << </span><span style='font-size:10.0pt;font-family:Consolas;color:#A31515'>"Pretty much a success !"</span><span style='font-size:10.0pt;font-family:Consolas;color:black'> << 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'> // 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'> CORBA::Object_ptr serverObj = namingContext->resolve_str(</span><span style='font-size:10.0pt;font-family:Consolas;color:#A31515'>"TestsServer"</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'> HeapTests_var distantServer = 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'> CORBA::String_var 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'> distantServer->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'> std::cout << str._retn() << 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'> <o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'> orb->run(); </span><span style='font-size:10.0pt;font-family:Consolas;color:green'>// Wait for incoming requests</span><span style='font-size:10.0pt;font-family:Consolas;color:black'><o:p></o:p></span></p><p class=MsoNormal><o:p> </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>> omniORB417_vc10_rtd.dll!omni::GIOP_S::dispatcher() Line 279 + 0x8 bytes C++<o:p></o:p></p><p class=MsoNormal><o:p> </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> </o:p></p><p class=MsoNormal>Thanks<o:p></o:p></p><p class=MsoNormal>Nicolas.<o:p></o:p></p></div></body></html>