[omniORB] OrbixNames-1.1c and omniORB (again)

Mark Borges mdb@jimi.nwest.attws.com
31 Jan 2001 11:29:21 -0800


--=-=-=

I realize that the issue of omniORB using the OrbixNames CosNaming
implementation has been raised on this list long, long ago. However, I
am somewhat puzzled by the fact that the omniORB utility, nameclt,
gets different results than an omniORBpy script, "get_orbix_ior.py"
that I wrote (see attached).

Using the same /etc/omniORB.cfg file of the form,

  ORBInitRef NameService=IOR:<elided>

the nameclt utility returns the IOR[1] for a resolve request,

IOR:000000000000002249444c3a74726f75626c655265706f72745f526571576f4d676d7449663a312e30000000000000010000000000000066000100000000001874737477666d732e6e776573742e61747477732e636f6d00062200000000003e3a5c74737477666d732e6e776573742e61747477732e636f6d3a616d733a303a3a49523a74726f75626c655265706f72745f526571576f4d676d74496600

whereas a resolve request on the _narrow()'d object in the python
script gives,

----------
omniORB: The object with the IR repository ID: IDL:omg.org/CosNaming/NamingContext:1.0
 returns FALSE to the query _is_a("IDL:omg.org/CosNaming/NamingContext:1.0").
 A CORBA::INV_OBJREF is raised.
----------

The puzzling thing (to me at least) is that if I don't _narrow() in
"get_orbix_ior.py", I get the same IOR as nameclt returns.

Obviously, I'm misunderstanding something, but it appears to me that
both nameclt and the python script should attempt to narrow the object
returned by the initial resolve_initial_references("NameService")
call.

I'm also attaching output obtained with "-ORBtraceLevel 20" for both
nameclt and get_orbix_ior.py in case it helps diagnose the problem
and/or misunderstanding.

Another minor observation. Using "nameclt list", I get

  ObjectGroups/
  ams.ams
  pwan.pwan/
  srms.srms
  list: Unexpected error encountered.

Not sure what that last "unexpected error encountered" refers to, but
I did capture a trace for it as well.

These results were obtained using the latest CVS snapshot of
omniORB/omniORBpy (01/31/01, "omni3_develop" tag) under Solaris-2.6
and built with gcc-2.95.2. For reference, the specific version of
Orbix and OrbixNames I'm attempting to interact with[2] are,

----------
$ orbixd -v
OrbixSSL Java enabled daemon v2.3c02-26
s1193-2.3c02-26: Orbix Version v2.3c02-26  for SunPro SPARCompiler C++ 4.1 on Solaris 2.x
$ ns -v
[ s1224: OrbixNames (Release 1.1) ]
[ s1369: OrbixOTM package (Release 1.0) ]
----------

Thanks for any help, insight, or pointers you can share.

-- 
 -mb-


Footnotes: 
[1]  I realize this returned IOR has the bogus underscore problem, but
     that's another issue.

[2]  I know, I should throw up the white flag and surrender with this
     attempt :-)


--=-=-=
Content-Disposition: attachment; filename=get_orbix_ior.py
Content-Description: get_orbix_ior.py

#!/usr/bin/env python
import sys, os

# extend the PYTHONPATH
sys.path.extend(['/opt/omniORB/lib','/opt/omniORB/lib/python'])

# Import the CORBA module
from omniORB import CORBA

# -----------------------------------------------------------------------
#def getObjectFromName(orb,nam):
def getObjectFromName(orb,name,path=None):

  """Retrieve an object reference using CORBAService's name service
  (CosNaming). PATH is an array of (name,kind) tuples, leading to the
  object reference bound to NAME, itself a (name,kind) tuple."""

  import sys, CosNaming

  # build up to the end of the naming contexts
  my_name = []
  if path is not None:
    for (n,k) in path:
      my_name = my_name + [CosNaming.NameComponent(n,k)]

  # add in the object name itself
  my_name = my_name + [CosNaming.NameComponent(name[0],name[1])]

  obj = None

  # Obtain a reference to the root context of the Name service:
  testObj = orb.resolve_initial_references("NameService")

  # This _narrow() implicitly calls _is_a(), which fails for Orbix-2.3c;
  # it returns FALSE(?!) so we cannot use it:
  # ----------
  # omniORB: The object with the IR repository ID: IDL:omg.org/CosNaming/NamingContext:1.0
  # returns FALSE to the query _is_a("IDL:omg.org/CosNaming/NamingContext:1.0").
  # A CORBA::INV_OBJREF is raised.
  # omniORB: throw INV_OBJREF from omniObjRef.cc:213
  # ----------

  rootContext = testObj._narrow(CosNaming.NamingContext)

  if rootContext is None:
    sys.stderr.write("Failed to narrow root naming context.\n")
    return CORBA.Object._nil() 

  is_a_got = rootContext._is_a("IDL:omg.org/CosNaming/NamingContext:1.0")
  print "is_a() returns =",is_a_got

  obj = testObj.resolve(my_name)

  # Make sure that the object is not a 'nil object reference'
  # (represented in Python by the value 'None').
  if obj is None:
    raise 'Nil object reference!'

  # Make sure that the object implements the expected interface!
  # Convert the IOR to an object reference
  string_ior = orb.object_to_string(obj)

  print "string IOR using testObj is:\n",string_ior
  try:

    obj = rootContext.resolve(my_name)

    # Make sure that the object is not a 'nil object reference'
    # (represented in Python by the value 'None').
    if obj is None:
      raise 'Nil object reference!'

    # Make sure that the object implements the expected interface!
    # Convert the IOR to an object reference
    string_ior = orb.object_to_string(obj)
  
  except CosNaming.NamingContext.NotFound, e:
    sys.stderr.write("Unable to resolve: " + `my_name` +
                     "-- not found:" + `e` + "\n")

  except CosNaming.NamingContext.InvalidName, e:
    sys.stderr.write("Requested name:" + `my_name` +
                     "-- is invalid:" + `e` + "\n")
  #
  return obj

# -----------------------------------------------------------------------

# Initialise the ORB
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
# get the object in the NameService
wfms = getObjectFromName(orb,('ams','ams'))
if wfms is not None:
  # Print out the IOR
  print orb.object_to_string(wfms)
else:
  print "Nil object reference!"

--=-=-=
Content-Disposition: attachment; filename=nameclt_resolve.trace
Content-Description: nameclt_resolve.trace

omniORB: gateKeeper is tcpwrapGK 1.0 - based on tcp_wrappers_7.6 
omniORB: The omniDynamic library is not linked.
omniORB: strand Rope::incrRefCount: old value = 0
omniORB: Creating ref to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a726f6f743a3a49523a436f734e616d696e675f4e616d696e67436f6e7465787400>
 target id      : IDL:omg.org/CORBA/Object:1.0
 most derived id: IDL:omg.org/CosNaming/NamingContext:1.0
omniORB: Initial reference `NameService' resolved from configuration file.
omniORB: LocateRequest to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a726f6f743a3a49523a436f734e616d696e675f4e616d696e67436f6e7465787400>
omniORB: strand Ripper: start.
omniORB: scavenger : start.
omniORB: strand Rope::incrRefCount: old value = 0
omniORB: Creating ref to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a726f6f743a3a49523a436f734e616d696e675f4e616d696e67436f6e7465787400>
 target id      : IDL:omg.org/CORBA/Object:1.0
 most derived id: :\:NS:::IR:CosNaming_NamingContext
omniORB: GIOP::LOCATION_FORWARD -- retry request.
omniORB: strand Rope::incrRefCount: old value = 1
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 1
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 2
omniORB: ObjRef(:\:NS:::IR:CosNaming_NamingContext) -- deleted.
omniORB: LocateRequest to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a726f6f743a3a49523a436f734e616d696e675f4e616d696e67436f6e7465787400>
omniORB: strand Rope_iterator: delete unused Rope.
omniORB: strand Rope::incrRefCount: old value = 0
omniORB: Creating ref to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a616d733a303a3a49523a74726f75626c655265706f72745f526571576f4d676d74496600>
 target id      : IDL:omg.org/CORBA/Object:1.0
 most derived id: IDL:troubleReport_ReqWoMgmtIf:1.0
IOR:000000000000002249444c3a74726f75626c655265706f72745f526571576f4d676d7449663a312e30000000000000010000000000000066000100000000001874737477666d732e6e776573742e61747477732e636f6d00062200000000003e3a5c74737477666d732e6e776573742e61747477732e636f6d3a616d733a303a3a49523a74726f75626c655265706f72745f526571576f4d676d74496600
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 1
omniORB: ObjRef(IDL:troubleReport_ReqWoMgmtIf:1.0) -- deleted.
omniORB: Preparing to shutdown ORB.
omniORB: scavenger : woken by poke()
omniORB: scavenger : exit.
omniORB: strand Ripper: exit.
omniORB: ORB shutdown is complete.
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 1
omniORB: ObjRef(IDL:omg.org/CosNaming/NamingContext:1.0) -- deleted.

--=-=-=
Content-Disposition: attachment; filename=get_ior.trace
Content-Description: get_orbix_ior.trace

omniORB: gateKeeper is tcpwrapGK 1.0 - based on tcp_wrappers_7.6 
omniORB: The omniDynamic library is not linked.
omniORB: strand Rope::incrRefCount: old value = 0
omniORB: Creating ref to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a726f6f743a3a49523a436f734e616d696e675f4e616d696e67436f6e7465787400>
 target id      : IDL:omg.org/CORBA/Object:1.0
 most derived id: IDL:omg.org/CosNaming/NamingContext:1.0
omniORB: Initial reference `NameService' resolved from configuration file.
omniORB: strand Rope::incrRefCount: old value = 1
omniORB: Creating Python ref to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a726f6f743a3a49523a436f734e616d696e675f4e616d696e67436f6e7465787400>
 target id      : IDL:omg.org/CORBA/Object:1.0
 most derived id: IDL:omg.org/CosNaming/NamingContext:1.0
omniORB: strand Rope::incrRefCount: old value = 2
omniORB: Creating Python ref to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a726f6f743a3a49523a436f734e616d696e675f4e616d696e67436f6e7465787400>
 target id      : IDL:omg.org/CosNaming/NamingContext:1.0
 most derived id: IDL:omg.org/CosNaming/NamingContext:1.0
omniORB: LocateRequest to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a726f6f743a3a49523a436f734e616d696e675f4e616d696e67436f6e7465787400>
omniORB: strand Ripper: start.
omniORB: scavenger : start.
omniORB: Python thread state scavenger start.
omniORB: scavenger : scanning connections
omniORB: strand Rope::incrRefCount: old value = 0
omniORB: Creating ref to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a726f6f743a3a49523a436f734e616d696e675f4e616d696e67436f6e7465787400>
 target id      : IDL:omg.org/CORBA/Object:1.0
 most derived id: :\:NS:::IR:CosNaming_NamingContext
omniORB: GIOP::LOCATION_FORWARD -- retry request.
omniORB: strand Rope::incrRefCount: old value = 1
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 3
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 2
omniORB: ObjRef(:\:NS:::IR:CosNaming_NamingContext) -- deleted.
omniORB: LocateRequest to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a726f6f743a3a49523a436f734e616d696e675f4e616d696e67436f6e7465787400>
omniORB: strand Rope::incrRefCount: old value = 2
omniORB: Creating Python ref to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a616d733a303a3a49523a74726f75626c655265706f72745f526571576f4d676d74496600>
 target id      : IDL:omg.org/CORBA/Object:1.0
 most derived id: IDL:troubleReport_ReqWoMgmtIf:1.0
omniORB: strand Rope::incrRefCount: old value = 1
omniORB: Creating ref to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a726f6f743a3a49523a436f734e616d696e675f4e616d696e67436f6e7465787400>
 target id      : IDL:omg.org/CORBA/Object:1.0
 most derived id: IDL:CosNaming_NamingContext:1.0
omniORB: GIOP::LOCATION_FORWARD -- retry request.
omniORB: strand Rope::incrRefCount: old value = 2
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 3
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 3
omniORB: ObjRef(IDL:CosNaming_NamingContext:1.0) -- deleted.
omniORB: The object with the IR repository ID: IDL:omg.org/CosNaming/NamingContext:1.0
 returns FALSE to the query _is_a("IDL:omg.org/CosNaming/NamingContext:1.0").
 A CORBA::INV_OBJREF is raised.
omniORB: throw INV_OBJREF from omniObjRef.cc:213
is_a() returns = 1
string IOR using testObj is:
IOR:000000000000002249444c3a74726f75626c655265706f72745f526571576f4d676d7449663a312e30000000000000010000000000000066000100000000001874737477666d732e6e776573742e61747477732e636f6d00062200000000003e3a5c74737477666d732e6e776573742e61747477732e636f6d3a616d733a303a3a49523a74726f75626c655265706f72745f526571576f4d676d74496600
Traceback (innermost last):
  File "./get_orbix_ior.py", line 92, in ?
    wfms = getObjectFromName(orb,('ams','ams'))
  File "./get_orbix_ior.py", line 66, in getObjectFromName
    obj = rootContext.resolve(my_name)
  File "/opt/omniORB/lib/python/Naming_idl.py", line 209, in resolve
    return _omnipy.invoke(self, "resolve", _0_CosNaming.NamingContext._d_resolve, args)
omniORB.CORBA.INV_OBJREF: Minor: 0, Completed: COMPLETED_NO.
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 2
omniORB: ObjRef(IDL:troubleReport_ReqWoMgmtIf:1.0) -- deleted.
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 2
omniORB: ObjRef(IDL:omg.org/CosNaming/NamingContext:1.0) -- deleted.
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 1
omniORB: ObjRef(IDL:omg.org/CosNaming/NamingContext:1.0) -- deleted.
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 1
omniORB: ObjRef(IDL:omg.org/CosNaming/NamingContext:1.0) -- deleted.

--=-=-=
Content-Disposition: attachment; filename=nameclt_list.trace
Content-Description: nameclt_list.trace

omniORB: gateKeeper is tcpwrapGK 1.0 - based on tcp_wrappers_7.6 
omniORB: The omniDynamic library is not linked.
omniORB: strand Rope::incrRefCount: old value = 0
omniORB: Creating ref to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a726f6f743a3a49523a436f734e616d696e675f4e616d696e67436f6e7465787400>
 target id      : IDL:omg.org/CORBA/Object:1.0
 most derived id: IDL:omg.org/CosNaming/NamingContext:1.0
omniORB: Initial reference `NameService' resolved from configuration file.
omniORB: LocateRequest to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a726f6f743a3a49523a436f734e616d696e675f4e616d696e67436f6e7465787400>
omniORB: strand Ripper: start.
omniORB: scavenger : start.
omniORB: strand Rope::incrRefCount: old value = 0
omniORB: Creating ref to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a726f6f743a3a49523a436f734e616d696e675f4e616d696e67436f6e7465787400>
 target id      : IDL:omg.org/CORBA/Object:1.0
 most derived id: :\:NS:::IR:CosNaming_NamingContext
omniORB: GIOP::LOCATION_FORWARD -- retry request.
omniORB: strand Rope::incrRefCount: old value = 1
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 1
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 2
omniORB: ObjRef(:\:NS:::IR:CosNaming_NamingContext) -- deleted.
omniORB: LocateRequest to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a726f6f743a3a49523a436f734e616d696e675f4e616d696e67436f6e7465787400>
omniORB: strand Rope_iterator: delete unused Rope.
omniORB: strand Rope::incrRefCount: old value = 0
omniORB: Creating ref to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a383a3a49523a436f734e616d696e675f42696e64696e674974657261746f7200>
 target id      : IDL:omg.org/CosNaming/BindingIterator:1.0
 most derived id: IDL:omg.org/CosNaming/BindingIterator:1.0
omniORB: LocateRequest to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a383a3a49523a436f734e616d696e675f42696e64696e674974657261746f7200>
omniORB: strand Rope::incrRefCount: old value = 1
omniORB: Creating ref to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a383a3a49523a436f734e616d696e675f42696e64696e674974657261746f7200>
 target id      : IDL:omg.org/CORBA/Object:1.0
 most derived id: :\:NS:::IR:CosNaming_BindingIterator
omniORB: GIOP::LOCATION_FORWARD -- retry request.
omniORB: strand Rope::incrRefCount: old value = 2
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 1
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 3
omniORB: ObjRef(:\:NS:::IR:CosNaming_BindingIterator) -- deleted.
omniORB: LocateRequest to remote: key<0x3a5c74737477666d732e6e776573742e61747477732e636f6d3a4e533a383a3a49523a436f734e616d696e675f42696e64696e674974657261746f7200>
ObjectGroups/
ams.ams
pwan.pwan/
srms.srms
omniORB: throw MARSHAL from exception.cc:422
omniORB: tcpSocketStrand::~Strand() close socket no. 5
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 2
omniORB: ObjRef(IDL:omg.org/CosNaming/BindingIterator:1.0) -- deleted.
list: Unexpected error encountered.
omniORB: Preparing to shutdown ORB.
omniORB: scavenger : woken by poke()
omniORB: scavenger : exit.
omniORB: strand Ripper: exit.
omniORB: ORB shutdown is complete.
omniORB: omniRemoteIdentity deleted.
omniORB: strand Rope::decrRefCount: old value = 1
omniORB: ObjRef(IDL:omg.org/CosNaming/NamingContext:1.0) -- deleted.

--=-=-=--