|
From: John G. <jgo...@co...> - 2001-11-08 17:17:53
|
Jeff Emanuel <je...@ad...> writes:
> This seems a little more familiar since you are loading the java
> class with a custom class loader. When this has worked for me
> before, I have always used the system default class loader.
Oddly enough, I didn't even realize that class loaders even existed
until your message yesterday, and certainly not that a non-default
loader was already being used. Alas, I fear that I have no control
over what loader is being used at the moment.
> Try finding the classloader for the superclass, as jython sees it.
> Something like this:
I tried this, just from Python at the top of the module:
print "Superclass loader: " + ListBO.getClassLoader().getClass().getName()
Prior to your suggested hack below, this printed out
org.python.core.SyspathJavaLoader.
> I suspect that the jython super is not loaded by the same classloader and
This is true...
> that is the root of your problems. I'm not sure if there is a way to
... but it doesn't seem to be the root of my problems.
> You might be able to set your custom classloader in the interpreter's
> name space and rewrite your scripts to use that. Something like this:
[ snip ]
I had to hack it to get the variable into the module, but I got it to
do that.
> ListBO=classloader.loadClass("quovix.business.util.ListBO")
Now, the above print displays com.lutris.classloader.MultiClassLoader
-- the same as for my code in static Java. But -- I still get the
same ClassCastException in Java as before -- probably because the
ListBOFoo object is still being loaded by Python's loader (ByteLoader1).
-- John
|