The same class has not the same classloader
Philipp Bolle <[email protected]> Tue, 23 Aug 2005 21:11:55 +0200
| Newsgroups | gmane.comp.jakarta.bcel.user |
|---|---|
| Organization | http://freemail.web.de/ |
| Message-ID | <[email protected]> |
Hi Liste,
First I like to say thank you for all the nice examples.
After a quick good start I ran into problems.
I have written a program that changes the extended class of a class. This is my code:
JavaClass java_class = Repository.lookupClass("de.sagd.xmldb.DebugResource");
java_class.setSuperclassName(resource.getClass().getName());
byte[] bytes = java_class.getBytes();
ClassLoader classloader = new org.apache.bcel.util.ClassLoader();
Class cl = classloader.loadClass("de.sagd.xmldb.$$BCEL$$" + Utility.encode(bytes, true));
Constructor constructor = cl.getConstructor(new Class[] {Resource.class});
The last line throws a java.lang.NoSuchMethodException.
I found out that:
cl.getConstructors()[0].getParameterTypes()[0].getClassLoader() has the value org.apache.bcel.util.ClassLoader and org.xmldb.api.base.Resource.class.getClassLoader() has the value sun.misc.Launcher$AppClassLoader.
But both of the classes are of type org.xmldb.api.base.Resource.
I tested my code with 5.1 and the SVN Version.
Any hint would be a big help.
Thanks in advance
Philipp
_________________________________________________________________________
Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle
Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179