Issue Type: Bug Bug
Assignee: Unassigned
Components: core
Created: 23/Jan/15 7:38 PM
Description:

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)}
Project: Jenkins
Labels: jelly classloader
Priority: Minor Minor
Reporter: Jesse Glick
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to