Archived

This forum has been archived. Please start a new discussion on GitHub.

IceGrid Support

Hi guys, I'm not programmer and I'm looking for support on ice grid.I'm
trying to integrate my application to an ORCA component that uses ICE as
a middleware. The problem I'm facing is that I need to provide an
interface for a remote component so it can call the methods on my
application. Although I have tried to follow the Ice manual, I did´t get
my interface published on the ICEGrid. Can someone help me by checking
what is wrong with my code? Is this the correct way to do it? You can
noticed on my code down below that I need everything hardcoded at this
moment, so, I can not rely on xml or script files:


Ice::PropertiesPtr props = Ice::createProperties();
props->setProperty("Ice.Default.Locator","IceGrid/Locator:tcp -h
localhost -p 12000");
props->setProperty("IceGrid.Registry.PermissionsVerifier","IceGrid/NullPermissionsVerifier");
props->setProperty("IceGrid.Registry.AdminPermissionsVerifier","IceGrid/NullPermissionsVerifier");
props->setProperty("IceGrid.Registry.DynamicRegistration","1");
Ice::InitializationData id;
id.properties = props;
ac = Ice::initialize(id);

Ice::ObjectAdapterPtr adapter =
ac->createObjectAdapterWithEndpoints("Casa/laser2d", "tcp -p 10001");
Ice::Identity ident = ac->stringToIdentity("laserscanner2d");
Ice::ObjectPrx factory = adapter->add(newdata, ident);
IceGrid::RegistryPrx registry =
IceGrid::RegistryPrx::checkedCast(factory);
IceGrid::AdminSessionPrx session;
session = registry->createAdminSession("xx", "ssss");
IceGrid::AdminPrx admin = session->getAdmin();
admin->addObject(factory);
adapter->activate();
ac->waitForShutdown();


I get the following error on the createAdminSession step:

terminate called after throwing an instance of
'IceUtil::NullHandleException'
what(): /usr/include/IceUtil/Handle.h:46:
IceUtil::NullHandleException
Aborted

Comments

  • benoit
    benoit Rennes, France
    Hi,

    The Ice::NullHandleException indicates that you are calling on a null smart pointer, in your case it's the registry proxy which is null.

    It looks like a misunderstanding, the registry proxy should be obtained using its well-known proxy not from the proxy of the Ice object you are registering with the adapter. For example:
    //
    // Create IceGrid adminstrative session
    //
    IceGrid::RegistryPrx registry = IceGrid::RegistryPrx::checkedCast(ac->stringToProxy("IceGrid/Registry"));
    if(!registry)
    {
         cerr << "couldn't find IceGrid registry" << endl;
         return;
    }
    IceGrid::AdminSessionPrx session = registry->createAdminSession("xx", "ssss"); 
    IceGrid::AdminPrx admin = session->getAdmin();
    
    //
    // Register Ice object and add it to the IceGrid well-known object database.
    //
    Ice::ObjectAdapterPtr adapter = ac->createObjectAdapterWithEndpoints("Casa/laser2d", "tcp -p 10001");
    Ice::Identity ident = ac->stringToIdentity("laserscanner2d");
    Ice::ObjectPrx obj = adapter->add(newdata, ident);
    admin->addObject(obj); 
    
    

    Cheers,
    Benoit.
  • Now it's working. I could check on the icegridadmin that my interface is published. Thank you very much for the clarification.
  • Hi it's me again.....


    Now I'm comparing my object with one of an application in icegridadmin:

    >>> object describe Casa.laserscanner2d/admin
    proxy = `Casa.laserscanner2d/admin -t:tcp -h 192.168.0.187 -p 10001 -t 5000'
    type = `::orca::RangeScanner2dData'
    >>> object describe Casa.laser2d/admin
    proxy = `Casa.laser2d/admin -f Casa.laser2d.Home -t:tcp -h 192.168.0.187 -p 40036 -t 5000'
    type = `::orca::Home'
    >>>


    the first one is my object and the second the object from ORCA component. I noticed the part in bold and I don't know what does it means.

    I also couldn't find my adapter listed on the icegrid. What else should I do to have it published?
  • benoit
    benoit Rennes, France
    Hi,

    The -f option specifies the facet name, see Proxy and Endpoint Syntax.

    Adapter endpoints are registered by servers either if the servers are deployed with the IceGrid XML descriptors with the IceGrid deployment mechanism or if you enable "dynamic registration" on the IceGrid registry. See here in the Ice manual for how to configure the registry to allow dynamic registration of adapters.

    Cheers,
    Benoit.
  • Thank you so much