From: Samuele P. <pe...@in...> - 2001-10-19 00:23:19
|
Hi. It was a bug, now it's fixed in the CVS. Starting with jython 2.0 inheriting from java classes from 3rd-party classloaders is supported by design but has not really been stressed ;). Patch: Index: MakeProxies.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/MakeProxies.java,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -d -r2.16 -r2.17 *** MakeProxies.java 2001/02/14 22:17:54 2.16 --- MakeProxies.java 2001/10/19 00:16:45 2.17 *************** *** 22,27 **** if (referent != null) { secondary.insertElementAt(referent,0); - referents = secondary; } } else { if (referent != null) { --- 22,27 ---- if (referent != null) { secondary.insertElementAt(referent,0); } + referents = secondary; } else { if (referent != null) { otherwise Workaround: class Foo(java.lang.Object, Java3rdPClassLoaderInterface): pass ^ regards, Samuele Pedroni. ----- Original Message ----- From: <Mat...@i2...> To: <jyt...@li...> Sent: Friday, October 19, 2001 12:01 AM Subject: [Jython-users] classloader funkiness when inheriting from java interfaces > I can use a custom classloader to load a Java class using a classpath > other than that given jython at startup. I can then define a new jython > class deriving from that Java class, and use it without any problems. > However, if I try and do the same thing with a Java exception, I get a > java.lang.NoClassDefFoundError exception. Anyone know why this is, or if > there is a workaround? I've provided an example below, just sub in values > for classpath/classname and you will only see the error when classname is > a java interface. > > from java.io import * > from java.net import * > from jarray import * > > # some.jar not in jython startup classpath > classpath = ["some.jar"] > classname = "some.class.in.some.jar" > > urls = array([File(each).toURL() for each in classpath], URL) > classLoader = URLClassLoader(urls) > javaClass = classLoader.loadClass(classname) > > class Foo(javaClass): > pass > > f = Foo() > > Any help appreciated, thanks, > > Matt > mat...@i2... > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |