JPython, Java and CORBA

Anshu Narula anshu at verecomm.com
Thu Aug 3 11:20:12 EDT 2000


Hi,

I am having trouble calling a member function of my Java class from
JPython.
This member function is returning a reference to an ior after being
narrowed. I have used idlj(jdk1.3Beta on Solaris 2.7) to generate the
stubs and skeltons. I have modified the
Hello.idl(jdk1.3/docs/guide/idl/tutorial) example to reflect my
problem.

If I do the same thing in Java instead of JPython, stuff works great. I
can't figure out how to tell JPython that "HelloMgr"  is the same as
"HelloApp.HelloMgr"
All suggestions are greatly appreciated.
Thanks,
Anshu


My Hello.idl
---------------------------------------------------------------

module HelloApp {
  interface Hello {
     string sayHello();
  };
  interface HelloMgr{
    Hello getHello();
  };
}

Added the following function in HelloClient.java
---------------------------------------------------------
  public HelloMgr getMgrRef() {
     return helloMgrRef;
  }
  where helloMgrRef is
  helloMgrRef = HelloMgrHelper.narrow(ncRef.resolve(path1));


My Test object looks like this
-------------------------------------
import java.*;
import HelloApp.*;

public class Test {

   public Test() {
   }

   public Test(HelloMgr a_hello_mgr) {
      System.out.println("From Test - if namespace problem goes away");
   }

}


My jpython file looks like this
-------------------------------------
import HelloClient
import Test

import HelloApp
from HelloApp import *

import java
from java import *
from java.lang import *;

class Client:
    def __init__(self):
       cl = HelloClient();
       print type(cl);
       str = cl.getStringMgr();
       mRef = cl.getMgrRef();
       print type(mRef);
       test = Test(mRef);
       System.out.println(str);

app = Client()


And the error I see
--------------------------
Traceback (innermost last):
  File "Client.py", line 21, in ?
  File "Client.py", line 18, in __init__
TypeError: Test(): 1st arg can't be coerced to HelloApp.HelloMgr











More information about the Python-list mailing list