I have a URLClassloader that runs the code in the class I am trying to instrument. The instrumented code uses reflection to call methods in another classloader that is one of the descendent in the class loader hierarchy, lets call it X. It works fine for me. But I would like to cache these into another class called CachedMethods and then call the instrumentation and have the instrumented code do CacheMethods.get("myMethod").invoke(). But I get a ClassNotFoundException at runtime. How do I load the cache in the classloader X and then make it available in the upstream URL Classloader ?
I have a URLClassloader that runs the code in the class I am trying to instrument. The instrumented code uses reflection to call methods in another classloader that is one of the descendent in the class loader hierarchy, lets call it X. It works fine for me. But I would like to cache these into another class called CachedMethods and then call the instrumentation and have the instrumented code do CacheMethods.get("myMethod").invoke(). But I get a ClassNotFoundException at runtime. How do I load the cache in the classloader X and then make it available in the upstream URL Classloader ?