After turning on mico debug output, I discovered the problem. I was
using a raw ip address rather than a host name to talk to the name
service. I was using the ip address because the hostname isn't visible
to my workstation. After inserting an appropriate entry into my
ect/hosts file, things are working now. 

However, I would think that mico shouldn't core dump on this kind of
error. Thoughts?

Thanks,
Chuck

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Irvine, Chuck R [LTD]
Sent: Friday, July 14, 2006 9:49 AM
To: [email protected]
Subject: [mico-devel] Connecting to an Orbix name service


I'm new to Corba (and Mico) and could sure use a little help ....

I'm writing a Corba client using Mico 2.3.12 which will talk to an Orbix
6.x server. First, can anyone verify that this should work?

The first thing I need to do is connect to the Orbix naming service and
I'm getting a segfault. I'm probably not doing something right. My call
to "orb->resolve_initial_references ("NameService")" returns without
error, but when I call "CosNaming::NamingContext::_narrow (nsobj)" on
the name service object, I get a segfault. I call my code thus: 

./get-orbix-name-service -ORBInitRef
NameService=corbaloc::10.77.83.35:3075/NameService

My sample code is given below. Any help would be hugely appreciated. 

Thanks,
Chuck

--------------get-orbix-name-service--------------------

#include <CORBA.h>
#include <coss/CosNaming.h>

using namespace std;

int main (int argc, char *argv[])
{
  // ORB initialization
  CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "mico-local-orb" );
 
  CORBA::Object_var nsobj =
    orb->resolve_initial_references ("NameService");
    
        if (CORBA::is_nil(nsobj)) {
                cerr << "oops, name service is nil" << endl;
                exit(1);
        }

  CosNaming::NamingContext_var nc = 
    CosNaming::NamingContext::_narrow (nsobj);

  if (CORBA::is_nil (nc)) {
    cerr << "oops, I cannot access the Naming Service!" << endl;
    exit (1);
  }
  
  cout << "acquired naming service" << endl;

  return 0;
}

-------------------------------------------------------------


_______________________________________________
Mico-devel mailing list
[email protected] http://www.mico.org/mailman/listinfo/mico-devel



_______________________________________________
Mico-devel mailing list
[email protected]
http://www.mico.org/mailman/listinfo/mico-devel

Reply via email to