[Jython-users] EJB Lookup
by Rubin, Dani other posts by this author
Oct 31 2003 2:14PM messages near this date
Re: [Jython-users] zxJDBC installation
|
Re: [Jython-users] EJB Lookup
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 confide
ntial
and is intended solely for the addressee. Access to this e-mail by anyone else is unauthoris
ed.
If you are not the intended recipient, any disclosure, copying, distribution or any action t
aken 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 an
d data
transmitted electronically and to preserve the confidentiality thereof, no liability or
responsibility whatsoever is accepted if information or data is, for whatever reason, corrup
ted
or does not reach its intended destination.
________________________________
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Jython-users mailing list
Jython-users@[...].net
https://lists.sourceforge.net/lists/listinfo/jython-users
Thread:
Rubin, Dani
Diez B. Roggisch
Gwyn Evans
|