[omniORB] Re: Strange problem with INV_OBJREF_InterfaceMisMatch using omniORBpy

Andreas Motl andreas.motl at ilo.de
Sun Jul 1 01:06:25 BST 2007


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.


Andreas Motl schrieb:
> 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 --------------
// ---------------------------------------------
//  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;
  
}


More information about the omniORB-list mailing list