You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-user@jakarta.apache.org by Philipp Bolle <pb...@web.de> on 2005/08/23 21:11:55 UTC
The same class has not the same classloader
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
---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org