1 Reply Latest reply on Jan 16, 2013 3:35 AM by roby14

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

    settimer

      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, where 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?

       

      The javassist edition I installed is: 3.13.0.GA

       

      Thanks!