Hi Andrei, yes, your nc variable is null. After any _narrow, you shall test if (CORBA::is_nil(<variable>)) to see if narrow failed or not.
May I suggest you have a look into demo/services/naming? The demo also provides Win32 makefile so it should be compilable and serve as a nice reference point for you. Personally I think something's wrong with your argv[3] value so it's not resolved/binded to nameservice internally and that's the reason why you probably get nil() NameService from resolve_initial_references call. Cheers, Karel On 10/12/13 12:14 PM, andr...@eed.usv.ro wrote: > Hi, my name is Smolenic Andrei and I am a Phd student at the Stefan cel > Mare University of Suceava, Romania. I've reached a point in my research > where I need to compare some CORBA implementations. I've chosen TAO and > MICO. First I've created a TAO based client-server distributed application > and all went well. At the moment I've come to a halt with the MICO > approach. Let me try to explain the problem. > > Setup: Windows 7 64 bit / Visual Studio 2010 Ultimate. > I downloaded the MICO sources and built them using the VS compiler (nmake > /f Makefile.win32). All went well so far. Next i've created a console app > to test the connectivity with the naming service. > I've applied the following config to my project: > - added D:\mico\win32-bin and D:\mico\include to C/C++ ->Additional > Include Directories > - added D:\mico\win32-bin\lib to Linker->Additional Library Directories > - added mico2313.lib and micocoss2313.lib to Linker->Input > - i've compiled the classic account idl file and added the resulting > account.h /.cc to the project > - i've implemented the required servant > > And the relevant piece of code: > > #include "account.h" > #include "coss\CosNaming.h" > ... > int main() > { > int argc = 4; > char* argv[4]; > argv[0] = "server"; > argv[1] = "-ORBNoResolve"; > argv[2] = "-ORBInitRef"; > argv[3] = "NameService=corbaloc::127.0.0.1:45678/NameService"; > > CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); > > CORBA::Object_var poaobj = orb->resolve_initial_references ("RootPOA"); > PortableServer::POA_var poa = PortableServer::POA::_narrow (poaobj); > PortableServer::POAManager_var mgr = poa->the_POAManager(); > > PortableServer::Servant account_servant = new Account_impl; > CORBA::Object_var the_account = account_servant->_this(); > > CORBA::Object_var nsobj = orb->resolve_initial_references("NameService"); > CosNaming::NamingContext_var nc=CosNaming::NamingContext::_narrow (nsobj); > > CosNaming::Name name; > name.length (1); > name[0].id = CORBA::string_dup ("testname"); > name[0].kind = CORBA::string_dup (""); > > nc->rebind (name, the_account); > > return 0; > } > > The problem is that when the narrowing of nsobj to > CosNaming::NamingContext occurs an CORBA::INV_POLICY is raised (but just > in the VS output) and the execution moves on. Then when the rebinding > takes place i get "Access violation reading location 0xfdfdfdfd". It is my > belief that this access violation occurs because the naming service wasn't > properly resolved/narrowed in the first place, not being able to > bind/rebind to a 'fake' naming context. > > I have searched around the web for a solution, i've documented myself > about the policies, about the exception itself but i have yet to find an > answer about what's going on. > > I start the naming service daemon with the following command: > nsd -ORBNoResolve -ORBDebug All -ORBIIOPAddr inet:127.0.0.1:45678 > > Maybe if someone has the time to give me a hint I would greatly appreciate > it. Thanks, > > Smolenic Andrei > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from > the latest Intel processors and coprocessors. See abstracts and register> > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk > _______________________________________________ > Mico-devel mailing list > Mico-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mico-devel > -- Karel Gardas kgar...@objectsecurity.com ObjectSecurity Ltd. http://www.objectsecurity.com ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk _______________________________________________ Mico-devel mailing list Mico-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mico-devel