Discussion:
[omniORB] Strange problem with INV_OBJREF_InterfaceMisMatch using omniORBpy
Andreas Motl
2007-07-01 00:28:34 UTC
Permalink
Hi there,

we are using omniORB4 and omniORBpy3 (client-side) together with Java1.5
ORB/org.omg.CORBA (server-side) for an exercise project at university.
Everything worked out well, but today we ran into some issues.

What already works without any problems:
- Obtaining object refs published by the Java side via omniNames (main API)
- Using object refs from objects created at the Python side and passed
as method arguments to the Java side (callback mechanism)


Today we tried to pass object refs created at the Java side to Python
which gives us a strange error when trying to invoke methods on these refs:
omniORB.CORBA.INV_OBJREF:
CORBA.INV_OBJREF(omniORB.INV_OBJREF_InterfaceMisMatch, CORBA.COMPLETED_NO)

I've annotated and attached the relevant parts of the trace from the
Python side.

Can you give us some hints on what we are doing wrong? Many thanks in
advance!

cheers, andi.
-------------- next part --------------
-----------------------------------------------------
A. obtaining initial object refs via name service
-----------------------------------------------------

omniORB: LocateRequest to remote: key<NameService>
omniORB: Creating Python ref to remote: key<............................RootPOA..............>
target id : IDL:omg.org/CORBA/Object:1.0
most derived id: IDL:Editor/CoreApi:1.0
omniORB: Creating Python ref to remote: key<............................RootPOA..............>
target id : IDL:omg.org/CORBA/Object:1.0
most derived id: IDL:Editor/GuiApi:1.0
omniORB: Creating Python ref to remote: key<............................RootPOA..............>
target id : IDL:omg.org/CORBA/Object:1.0
most derived id: IDL:Editor/ContentApi:1.0
omniORB: ObjRef() -- deleted.

These are the three parts of our API at the Java side obtained via name service lookup.
Calling methods on these is no problem.


-----------------------------------------------------
B. narrowing object ref returned by method call
-----------------------------------------------------

omniORB: LocateRequest to remote: key<............................RootPOA..............>
omniORB: Client attempt to connect to giop:tcp:192.168.178.21:4540
omniORB: Client opened connection to giop:tcp:192.168.178.21:4540
Registered plugin at host: True
omniORB: LocateRequest to remote: key<............................RootPOA..............>
omniORB: Creating Python ref to remote: key<............................RootPOA..............>
target id : IDL:Editor/Testing:1.0
most derived id: IDL:Editor/Testing:1.0


This is the result after calling an api method which returns an object ref. This object
ref gets properly narrowed:
mytest = self.editor_gui.test1("hello")
t = mytest._narrow(Editor.Testing)

print t gives us....
<Editor._objref_Testing instance at 0x00C5FFA8>

print t.abc (abc is an example method of t) gives us...
<bound method _objref_Testing.abc of <Editor._objref_Testing instance at 0x00C5FFA8>>

So everything seems to be fine!?



-----------------------------------------------------
C. the error
-----------------------------------------------------

When actually invoking ....
print t.abc("huhu")

... the exception gets raised:

omniORB: omniORB: The object with the IR repository ID: IDL:Editor/Testing:1.0
returns FALSE to the query _is_a("IDL:Editor/Testing:1.0").
A CORBA::INV_OBJREF is raised.
omniORB: throw INV_OBJREF from omniObjRef.cc:407 (NO,INV_OBJREF_InterfaceMisMatch)
Traceback (most recent call last):
File "./guitest.py", line 114, in ?
main()
File "./guitest.py", line 109, in main
p.do_tests()
File "./guitest.py", line 96, in do_tests
self.do_x()
File "./guitest.py", line 90, in do_x
print t.abc("huhu")
File "c:\home\amo\Studium\Material Semester 4\Middleware\Code\trunk\src\plugins\python\editor_idl.py", line 500, in abc
return _omnipy.invoke(self, "abc", _0_Editor.Testing._d_abc, args)
omniORB.CORBA.INV_OBJREF: CORBA.INV_OBJREF(omniORB.INV_OBJREF_InterfaceMisMatch, CORBA.COMPLETED_NO)


-----------------------------------------------------
D. comments
-----------------------------------------------------
1. The method call is done with the right signature, otherwise (e.g.) a "TypeError: Operation requires 1 argument; 0 given"
would have been raised.

2. The message ...
The object with the IR repository ID: IDL:Editor/Testing:1.0 returns FALSE to the query _is_a("IDL:Editor/Testing:1.0")
...is rather puzzling to me. Aren't apples apples?
Andreas Motl
2007-07-01 04:06:17 UTC
Permalink
Hello,

i solved the issue. Of course it was due to my lack of knowledge about
CORBA and the Java ORB. After testing that it didn't work with a Java
client as well, i figured out what was wrong at the server side.

If you're curios, i attached the erroneous code as well as the working
one. Perhaps you have additional hints for us.

cheers, andi.
Post by Andreas Motl
Hi there,
we are using omniORB4 and omniORBpy3 (client-side) together with Java1.5
ORB/org.omg.CORBA (server-side) for an exercise project at university.
Everything worked out well, but today we ran into some issues.
- Obtaining object refs published by the Java side via omniNames (main API)
- Using object refs from objects created at the Python side and passed
as method arguments to the Java side (callback mechanism)
Today we tried to pass object refs created at the Java side to Python
CORBA.INV_OBJREF(omniORB.INV_OBJREF_InterfaceMisMatch, CORBA.COMPLETED_NO)
I've annotated and attached the relevant parts of the trace from the
Python side.
Can you give us some hints on what we are doing wrong? Many thanks in
advance!
cheers, andi.
-------------- next part --------------
// ---------------------------------------------
// idl
// ---------------------------------------------

module Editor {

interface Testing {
string abc(in string def);
};

interface MyAPI {
Testing test1();
Testing test2();
}

}


// ---------------------------------------------
// java
// ---------------------------------------------

// a simple class implementing Editor.Testing
class MyTest extends Editor.TestingPOA {
public String abc(String def) {
System.out.println(def);
return def;
}
}

// first attempt (failed)
public Editor.Testing test1() {

MyTest mytest = new MyTest();
print("MyTest: " + mytest.toString());

Editor.Testing t = mytest._this(editor.server.orb);
print("Editor.Testing: " + t.toString());

return t;
}

// second attempt (works)
public Editor.Testing test2() {
MyTest mytest = new MyTest();
print("MyTest: " + mytest.toString());

// we have to get the reference to our servant ...
org.omg.CORBA.Object ref = null;
try {
ref = editor.server.poa.servant_to_reference(mytest);
} catch (Exception e) {
System.out.println("Exception: " + e);
}
print("org.omg.CORBA.Object: " + ref.toString());

// ... and narrow it back
Editor.Testing testing = Editor.TestingHelper.narrow(ref);

return testing;

}

Loading...