Hi Jerome / Kohsuke (or anyone that can help),
The admin GUI provides a @Contract for anyone to implement via a
@Service. I get the implementations and can iterate over them, and
using their individual ClassLoaders, I can get resources from these jar
file (i.e. configuration files). This works fine.
Now, I want to be able to use the ClassLoader supplied by one of these
modules to invoke Java code. I do this:
Class moduleClass = moduleClassLoader.loadClass(name);
This works. However, I then do:
moduleClass.getMethod("something", new Class[] {HandlerContext.class});
This blows up:
java.lang.NoClassDefFoundError:
com/sun/jsftemplating/layout/descriptors/handler/HandlerContext
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getMethod0(Class.java:2670)
at java.lang.Class.getMethod(Class.java:1603)
at
com.sun.jsftemplating.layout.descriptors.handler.HandlerDefinition.getHandlerMethod(HandlerDefinition.java:157)
Now I know "HandlerContext.class" that I pass into the getMethod() call
is loaded from a different ClassLoader than "moduleClass" which I
believe is the problem... the question is: How do I resolve this? Or:
How should I be doing this differently? I suspect I'm also in for more
problems as other classes in the "something" method also need to be
resolved.
Thanks,
Ken