AW: Null naming context while requesting NameService

> Hi,
> 	I'm trying to get started with ORBit programming, I successfully
> managed to write my first "HelloWorld" using the IOR and now I'm trying to
> make it evolve in order to use NameService, the problem is that when i try
> to get the NamingContext i get a null referance here:
> /* ... */
>   CosNaming_NamingContext nc;
>   CORBA_Environment * ev;
>   ev = g_new0(CORBA_Environment,1);
>   CORBA_exception_init(ev);
>   orb = CORBA_ORB_init(&argc, argv, "orbit-local-orb", ev);
>   checkEx(ev);
>   nc = CORBA_ORB_resolve_initial_references(orb,"NameService",ev);
>   /* checkEx is a simple function that exits if ev->_major is not
>   checkEx(ev);
>   /* check wether nc is null */
>   if(nc == NULL){
>     printf("Cannot resolve service \n");
>     exit(1);
>   }
> /* ... */
> I put the naming context check after CosNaming>NamingContext>bind produced
> I always get "Cannot resolve service"
> I don't know what to do to make it work, can some one help me ?

I tried something like that some time ago, and if I remember correctly you
can't get the
nameserver this way (can't remember the reason).
You should start orbit-nameserver which then writes its ID to stdout.
Redirect this to a file and let your program read it from the file, so you
can connect to the nameserver.
Then everything should work fine.

Hope this helps

Rolf Schaeuble

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]