JBoss Community

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

created by settimer in Javassist - View the full discussion

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

Start a new discussion in Javassist at Community