-
Bug
-
Resolution: Unresolved
-
Minor
If in j:getStatic or j:invokeStatic you specify a className which is in a plugin, then try to render the resulting Jelly view, you get
java.lang.ClassNotFoundException: some.Class at org.jenkinsci.maven.plugins.hpi.ServletApiOnlyClassLoader.findClass(ServletApiOnlyClassLoader.java:25) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325) at org.apache.commons.jelly.tags.core.GetStaticTag.doTag(GetStaticTag.java:106)
Indeed GetStaticTag does
Class type = ClassLoaderUtils.getClassLoader(getClass()).loadClass(className);
which calls
public static ClassLoader getClassLoader(Class clazz) { ClassLoader callersLoader = clazz.getClassLoader(); if (callersLoader == null) { callersLoader = ClassLoader.getSystemClassLoader(); } return callersLoader; }
so there is no way this could work.
Workaround:
${app.pluginManager.uberClassLoader.loadClass('some.Class').getField('field').get(null)} ${app.pluginManager.uberClassLoader.loadClass('pkg.SomeExtension').getMethod('all', null).invoke(null, null)}
- relates to
-
JENKINS-31203 Stapler facet based on typesafe Java plus static HTML
- Open
-
JENKINS-41827 JenkinsRule mode to use realistic class loading
- Resolved