Discussion:
[omniORB] RootPOA and omniINSPOA together
Urban Purkat
2009-11-10 19:58:19 UTC
Permalink
Hi!

I am working on openarchive project (http://www.openarchive.net/).
The product uses omniORB for its IPC library with connection to
omniNames service.
It currently uses "RootPOA" and it works fine for communication within
one openarchive system.

I would like to connect two systems. Therefore the first system needs to
connect to the second system's name service (NS2) to resolve objects.
Since omniORB does not allow me to have multiple orb instances this is
not doable.
I thought I can implement fixed references for some servants and resolve
objects from a predefined string.
In order to do that I introduced a secondary POA (omniINSPOA).

Here's a code snippet where I initialize omniORB:
m_orb = CORBA::ORB_init(a_argc, a_argv, s_orbName, options);
obj = m_orb->resolve_initial_references("RootPOA");
m_poa = PortableServer::POA::_narrow(obj);

// New code
obj = m_orb->resolve_initial_references("omniINSPOA");
m_poa2 = PortableServer::POA::_narrow(obj);
// New code end

obj = m_orb->resolve_initial_references("NameService");
m_rootContext = CosNaming::NamingContext::_narrow(obj);

After that I am ready to resolve objects from NS.
Note: The endPoint parameter is not set.

In management interface process (MIF) servant constructor I register to
naming service and additionally also activate servant using ID:

string objectName("mif");
PortableServer::ObjectId_var oid =
PortableServer::string_to_ObjectId(objectName.c_str());
m_poa2->activate_object_with_id(oid, this);

In order to be able to resolve this object from another process using a
fixed object name I need to set the endPoint parameter to
giop:tcp:ivd-test-01.topit.si:2809.
After I set it I cannot resolve any object using NS. But If I leave port
empty (giop:tcp:ivd-test-01.topit.si:) NS resolution is successful, but
I cannot narrow fixed object using the following code:
string objectUri = string("corbaloc:iiop:") + m_hostname +
string(":2809/mif");
CORBA::Object_var obj = m_orb->string_to_object(objectUri.c_str());

i_ManagementInterface_var mif = i_ManagementInterface::_narrow(obj);

Here's trace:
omniORB: Creating ref to remote: key<mif>
target id : IDL:omg.org/CORBA/Object:1.0
most derived id:
omniORB: Invoke '_is_a' on remote: key<mif>
omniORB: Client attempt to connect to giop:tcp:ivd-test-01.topit.si:2809
omniORB: Name 'ivd-test-01.topit.si' resolved: 10.99.100.151
omniORB: Client opened connection to giop:tcp:10.99.100.151:2809
omniORB: sendChunk: to giop:tcp:10.99.100.151:2809 86 bytes
omniORB: inputMessage: from giop:tcp:10.99.100.151:2809 76 bytes
omniORB: throw OBJECT_NOT_EXIST from GIOP_C.cc:284
(NO,OBJECT_NOT_EXIST_NoMatch)
omniORB: throw OBJECT_NOT_EXIST from omniObjRef.cc:833
(NO,OBJECT_NOT_EXIST_NoMatch)
omniORB: omniRemoteIdentity deleted.
omniORB: ObjRef() -- deleted.

The omniORB configuration can be found at the end of mail.

Can both POAs be used together?
If no, do you have any other ideas how to connect to the other system?
I would really appreciate some help.

Regards,
Urban


Here's my configuration:
omniORB: DefaultInitRef (file) =
omniORB: DefaultInitRef (args) = corbaloc:iiop:ivd-test-01.topit.si:2809
omniORB: InitRef = NameService=corbaname:iiop:ivd-test-01.topit.si:2809
omniORB: abortOnInternalError = 0
omniORB: abortOnNativeException = 0
omniORB: acceptBiDirectionalGIOP = 0
omniORB: acceptMisalignedTcIndirections = 0
omniORB: bootstrapAgentHostname =
omniORB: bootstrapAgentPort = 900
omniORB: clientCallTimeOutPeriod = 172800000
omniORB: clientConnectTimeOutPeriod = 0
omniORB: clientTransportRule = localhost tcp
omniORB: clientTransportRule = 127.0.0.0/255.255.255.0 tcp
omniORB: clientTransportRule = * none
omniORB: configFile = C:\Program Files\GDS\IVD\etc\omniORB.cfg
omniORB: connectionWatchImmediate = 0
omniORB: connectionWatchPeriod = 50000
omniORB: copyValuesInLocalCalls = 1
omniORB: diiThrowsSysExceptions = 0
omniORB: dumpConfiguration = 0
omniORB: endPoint = giop:tcp:ivd-test-01.topit.si:
omniORB: endPointPublish = addr
omniORB: giopMaxMsgSize = 2097152
omniORB: giopTargetAddressMode = KeyAddr
omniORB: id = omniORB4
omniORB: idleThreadTimeout = 10
omniORB: immediateAddressSwitch = 0
omniORB: inConScanPeriod = 15
omniORB: lcdMode = 0
omniORB: maxGIOPConnectionPerServer = 64
omniORB: maxGIOPVersion = 1.2
omniORB: maxInterleavedCallsPerConnection = 5
omniORB: maxServerThreadPerConnection = 100
omniORB: maxServerThreadPoolSize = 100
omniORB: maxSocketRecv = 131072
omniORB: maxSocketSend = 131072
omniORB: nativeCharCodeSet = UTF-8
omniORB: nativeWCharCodeSet = UTF-16
omniORB: objectTableSize = 0
omniORB: offerBiDirectionalGIOP = 0
omniORB: oneCallPerConnection = 1
omniORB: outConScanPeriod = 10
omniORB: poaHoldRequestTimeout = 0
omniORB: poaUniquePersistentSystemIds = 1
omniORB: principal = [Null]
omniORB: resetTimeOutOnRetries = 0
omniORB: scanGranularity = 1
omniORB: serverCallTimeOutPeriod = 0
omniORB: serverTransportRule = localhost tcp
omniORB: serverTransportRule = 127.0.0.0/255.255.255.0 tcp
omniORB: serverTransportRule = * none
omniORB: socketSendBuffer = 16384
omniORB: strictIIOP = 1
omniORB: supportBootstrapAgent = 0
omniORB: supportCurrent = 1
omniORB: supportPerThreadTimeOut = 0
omniORB: tcAliasExpand = 0
omniORB: threadPerConnectionLowerLimit = 9000
omniORB: threadPerConnectionPolicy = 1
omniORB: threadPerConnectionUpperLimit = 10000
omniORB: threadPoolWatchConnection = 1
omniORB: traceExceptions = 1
omniORB: traceFile = [stderr]
omniORB: traceInvocationReturns = 0
omniORB: traceInvocations = 1
omniORB: traceLevel = 25
omniORB: traceThreadId = 0
omniORB: traceTime = 0
omniORB: unixTransportDirectory = /tmp/omni-%u
omniORB: unixTransportPermission = 777
omniORB: useTypeCodeIndirections = 1
omniORB: validateUTF8 = 0
omniORB: verifyObjectExistsAndType = 1
Duncan Grisby
2009-11-10 20:30:24 UTC
Permalink
Post by Urban Purkat
I would like to connect two systems. Therefore the first system needs to
connect to the second system's name service (NS2) to resolve objects.
Since omniORB does not allow me to have multiple orb instances this is
not doable.
Why do you think it is not doable? You're right than you can have only
one ORB, but that has no bearing on how many naming service references
you can use. The naming service is just a collection of CORBA objects,
so you can refer to as many as you like.

That said, the naming service is designed to be a centralised mapping of
names to object references, so you'd often run a single naming service
in an environment and store all the name mappings there, rather than one
naming service per machine.
Post by Urban Purkat
I thought I can implement fixed references for some servants and resolve
objects from a predefined string.
In order to do that I introduced a secondary POA (omniINSPOA).
[...]

I'm very confused by what you're trying to achieve. The omniINSPOA is
there to support the use of corbaloc URIs, which you normally use
instead of the naming service, not as well as it. (corbaloc is part of
the Interoperable Naming Service specification, hence the INS in
omniINSPOA.)

If you are using the naming service, you definitely shouldn't tell your
server to listen on port 2809, since that's the port omniNames will
listen on.

What exactly are you trying to do? Why do you feel the need to use
omniINSPOA?

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Urban Purkat
2009-11-10 21:11:45 UTC
Permalink
Post by Duncan Grisby
Post by Urban Purkat
I would like to connect two systems. Therefore the first system needs to
connect to the second system's name service (NS2) to resolve objects.
Since omniORB does not allow me to have multiple orb instances this is
not doable.
Why do you think it is not doable? You're right than you can have only
one ORB, but that has no bearing on how many naming service references
you can use. The naming service is just a collection of CORBA objects,
so you can refer to as many as you like.
That said, the naming service is designed to be a centralised mapping of
names to object references, so you'd often run a single naming service
in an environment and store all the name mappings there, rather than one
naming service per machine.
But I have to specify the nameservice at the ORB_Init():
omniORB: DefaultInitRef (args) = corbaloc:iiop:ivd-test-01.topit.si:2809
omniORB: InitRef = NameService=corbaname:iiop:ivd-test-01.topit.si:2809

Then I resolve it using:
m_orb->resolve_initial_references("NameService");
m_rootContext = CosNaming::NamingContext::_narrow(obj);

How can I get the reference to another NS?
Post by Duncan Grisby
Post by Urban Purkat
I thought I can implement fixed references for some servants and resolve
objects from a predefined string.
In order to do that I introduced a secondary POA (omniINSPOA).
[...]
I'm very confused by what you're trying to achieve. The omniINSPOA is
there to support the use of corbaloc URIs, which you normally use
instead of the naming service, not as well as it. (corbaloc is part of
the Interoperable Naming Service specification, hence the INS in
omniINSPOA.)
If you are using the naming service, you definitely shouldn't tell your
server to listen on port 2809, since that's the port omniNames will
listen on.
What exactly are you trying to do? Why do you feel the need to use
omniINSPOA?
I have two independent systems (primary and secondary). Each have its
own NS running.
I would like to resolve the reference of the other system's servant. So
since I was not aware that it is possible to use several naming services
(I still do not know how), I thought I can have one servant using a
persistent object ID and resolve it using corbaloc.

So if I am able to get the NS object reference that "belobgs" to
secondary from the primary system I am more than satisfied.

Regards,
Urban
Bailey, Kendall
2009-11-10 21:50:13 UTC
Permalink
-----Original Message-----
Sent: Tuesday, November 10, 2009 9:12 AM
To: Duncan Grisby
Subject: Re: [omniORB] RootPOA and omniINSPOA together
omniORB: DefaultInitRef (args) = corbaloc:iiop:ivd-test-
01.topit.si:2809
omniORB: InitRef = NameService=corbaname:iiop:ivd-test-
01.topit.si:2809
...
I have two independent systems (primary and secondary). Each have its
own NS running.
I would like to resolve the reference of the other system's servant. So
since I was not aware that it is possible to use several naming services
(I still do not know how), I thought I can have one servant using a
persistent object ID and resolve it using corbaloc.
So if I am able to get the NS object reference that "belobgs" to
secondary from the primary system I am more than satisfied.
Regards,
Urban
The way you've configured the InitRef demonstrates that the NameService
itself is resolvable via a corbaname URI. So you can have your app
resolve any additional name service via such a URI passed to the
string_to_object() function. Once you get the Object reference back,
narrow it to a NamingContext and use it. The resolve_initial_references()
mechanism is a convenience, but you are free to have your app read
object reference strings ( IOR: or corbaname: or corbaloc: ) in from any other
sources (database, command line, flat file, user input, ... ) and
convert those to CORBA::Object references via the string_to_object() function.

Good luck,
Kendall
Urban Purkat
2009-11-11 12:35:48 UTC
Permalink
Post by Bailey, Kendall
The way you've configured the InitRef demonstrates that the NameService
itself is resolvable via a corbaname URI. So you can have your app
resolve any additional name service via such a URI passed to the
string_to_object() function. Once you get the Object reference back,
narrow it to a NamingContext and use it. The resolve_initial_references()
mechanism is a convenience, but you are free to have your app read
object reference strings ( IOR: or corbaname: or corbaloc: ) in from any other
sources (database, command line, flat file, user input, ... ) and
convert those to CORBA::Object references via the string_to_object() function.
Good luck,
Kendall
That's the information I needed. Thank you very much.
I did not think it is that simple ;)

Regards,
Urban

Loading...