[jboss-user] [Javassist user questions] - Problem using ClassLoaders with Javassit (without the applic
dsperry
do-not-reply at jboss.com
Sat Sep 2 12:20:36 EDT 2006
Hi All,
There is problem with javassit and ClassLoaders for wich there is a solution, but involves changing javassit.ClassClassPath a little bit.
= Here goes the problem: =
I am using a special classloader to load an application wich I cannot change.
This application uses javassit, so javassit ends up been loaded by my classloader.
Usually this application runs without my classloader.
Eventualy ClassPool.createCtClass("ClassX",..) is called and, later ClassClassPath.find. At this point javassit.NotFoundException occurs. See the error at the end of this post.
= Here the scenario: =
java.lang.Object is loaded by the System ClassLoader
javassit.ClassClassPath is loaded by my ClassLoader
ClassX is loaded by my ClassLoader
But ClassClassPath asks to java.lang.Object where is the bytecode for "ClassX".
= Here a comment from javassit.ClassClassPath constructor: =
anonymous wrote :
| /* The value of thisClass was this.getClass() in early versions:
| *
| * thisClass = this.getClass();
| *
| * However, this made openClassfile() not search all the system
| * class paths if javassist.jar is put in jre/lib/ext/
| * (with JDK1.4).
| */
| this(java.lang.Object.class);
|
Fine, but this created a new bug which is cited in other posts such as:
"Javassist and Tomcat 4.1"
http://jboss.com/index.html?module=bb&op=viewtopic&p=3902342
"javassist.NotFoundException?: org.neo.swarmdesk.components.S"
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=33476
"Re: Problems using custom ClassLoader" http://www.opensubscriber.com/message/hivemind-user@jakarta.apache.org/514059.html
= Here a possible solution: =
Assign thisClass=this.getClass() at the default constructor.
Change the implementation of ClassClassPath.openClassfile and
ClassClassPath.find to look for the bytecodes also at java.lang.Object.class.getResource() if the default
constructor was called
i.e: if the resource was not found and thisClass==this.getClass() then search for the resource with java.lang.Object.class.getResource()
Regards and thanks in advance,
Daniel Sperry
----
Caused by: javassist.NotFoundException: com.hoplon.bitverse.handlers.HandlerCaller
at javassist.ClassPool.get(ClassPool.java:389)
at com.hoplon.bitverse.handlers.BytecodeHandler.createHandlerCaller(BytecodeHandler.java:117)
... 12 more
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969053#3969053
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969053
More information about the jboss-user
mailing list