[jboss-user] [Javassist] - Interaction of javassist and java.lang.instrument.Instrumentation.appendToBootstrapClassLoaderSearch(JarFile)

settimer do-not-reply at jboss.com
Wed Oct 24 00:50:15 EDT 2012


settimer [https://community.jboss.org/people/settimer] created the discussion

"Interaction of javassist and java.lang.instrument.Instrumentation.appendToBootstrapClassLoaderSearch(JarFile)"

To view the discussion, visit: https://community.jboss.org/message/771995#771995

--------------------------------------------------------------
Inside "public static void premain(String agentArgs, Instrumentation inst)", I invoked "appendToBootstrapClassLoaderSearch(myJar)" to add myJar into the search path of the bootstrap classloader.

Java reflection code like "Class theClass = Class.forName("myclass");" succeeded, while myclass is a class contained in myJar, while "ClassPool.getDefault().get("myclass")" incurs javassist.NotFoundException.

Similarly, CtClass.insertBefore("some code refers to myclass") incurs "javassist.CannotCompileException: [source error] no such class". (I guess it is due to the same reason as above.)

Does it imply that the appendToBootstrapClassLoader has no effect on the search path of the default class pool? But the default class pool uses the system class loader to resolve a class, which includes the bootstrap search path, right?

Thanks!
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/771995#771995]

Start a new discussion in Javassist at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2062]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20121024/7eaa3a44/attachment.html 


More information about the jboss-user mailing list