From: Rubin, D. <DR...@fn...> - 2003-10-31 14:15:16
|
Hi I am trying to do an EJB context lookup using the following code: class EJBCaller3: if __name__ == '__main__': from java.lang import String from java.util import Properties,Random,Hashtable from javax.naming import Context from javax.naming import InitialContext from javax.rmi import PortableRemoteObject from za.co.payworks.dto.report import PayrollImportReportDTO from za.co.payworks.report.business.reportmanager import ReportManager from za.co.payworks.report.business.reportmanager import ReportManagerHome from za.co.payworks.util.test import PayworksJTestCase print "imports successfull" p = Properties() p[Context.INITIAL_CONTEXT_FACTORY] = "com.ibm.websphere.naming.WsnInitialContextFactory" p[Context.PROVIDER_URL]="iiop://localhost:2809/" ctx = InitialContext(p) rmh = PortableRemoteObject.narrow(ctx.lookup("ejb/ReportManager"), ReportManagerHome.class) entity = rmh.create toSB = PayrollImportReportDTO inTest = entity.getPayrollImportReport(toSB) assert len(inTest), "Byte array returned is empty" the compiler, however is complaining about: java.lang.ClassCastException: cannot cast class org.omg.stub.java.rmi._Remote_Stub to class java.lang.Class at com.ibm.rmi.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java: 366) at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:146) at java.lang.reflect.Method.invoke(Native Method) at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java Since Jython is not a type language, it is a mystery to me how one would cast the remote object. Has anyone got any ideas? Dani Rubin Johannesburg South Africa ___________________________________________________________________________________________________ The views expressed in this email are, unless otherwise stated, those of the author and not those of the FirstRand Banking Group or its management. The information in this e-mail is confidential and is intended solely for the addressee. Access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted in reliance on this, is prohibited and may be unlawful. Whilst all reasonable steps are taken to ensure the accuracy and integrity of information and data transmitted electronically and to preserve the confidentiality thereof, no liability or responsibility whatsoever is accepted if information or data is, for whatever reason, corrupted or does not reach its intended destination. ________________________________ |