BingXi Li
created JENKINS-18972
About class loader of Dynamic Choice Parameter (Scriptler) (Version 0.2.0)
Issue Type:
Bug
Assignee:
Unassigned
Components:
dynamicparameter
Created:
29/Jul/13 4:44 AM
Description:
When we were using "Dynamic Choice Parameter (Scriptler)", we found something is not right.We wanted to run a script, which would import classes of svnkit, to get a list of pathes in svn.
The script was as follow:
import java.util.*
import org.tmatesoft.svn.core.ISVNDirEntryHandler
import org.tmatesoft.svn.core.SVNDirEntry
import org.tmatesoft.svn.core.SVNNodeKind
import org.tmatesoft.svn.core.SVNException
class SVNDirEntryHandlerImpl implements ISVNDirEntryHandler {
ListSVNDirEntry dirs = new ArrayListSVNDirEntry()
void handleDirEntry(SVNDirEntry dirEntry) throws SVNException {
dirs.add(dirEntry)
}
}
def h = new SVNDirEntryHandlerImpl()
// get svn client, and list dir from svn
// we do not show it, because it is not important
def result = []
h.dirs.each() {
def dirName = it.name
if (null != dirName dirName.length() 0 SVNNodeKind.DIR == it.kind) {
result.add(dirName)
}
result.add(dirName)
}
return result
The script was run well in Scriptler, but we got an empty list in job build parameter, without any errors.We read the log of tomcat, and we found "unable to resolve class" error.
Log was as follow:
2013-7-29 10:37:34 com.seitenbau.jenkins.plugins.dynamicparameter.BaseParameterDefinition executeScript
严重: Error during executing script for parameter 'test'
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 4: unable to resolve class org.tmatesoft.svn.core.SVNNodeKind
@ line 4, column 1.
import org.tmatesoft.svn.core.SVNNodeKind
^
Script1.groovy: 5: unable to resolve class org.tmatesoft.svn.core.SVNException
@ line 5, column 1.
import org.tmatesoft.svn.core.SVNException
^
Script1.groovy: 2: unable to resolve class org.tmatesoft.svn.core.ISVNDirEntryHandler
@ line 2, column 1.
import org.tmatesoft.svn.core.ISVNDirEntryHandler
^
Script1.groovy: 3: unable to resolve class org.tmatesoft.svn.core.SVNDirEntry
@ line 3, column 1.
import org.tmatesoft.svn.core.SVNDirEntry
^
4 errors
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:302)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:858)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:548)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:497)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:287)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:731)
at groovy.lang.GroovyShell.parse(GroovyShell.java:743)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:578)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:618)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
at com.seitenbau.jenkins.plugins.dynamicparameter.util.JenkinsUtils.execute(JenkinsUtils.java:88)
at com.seitenbau.jenkins.plugins.dynamicparameter.scriptler.ScriptlerParameterDefinition$ParameterizedScriptCall.call(ScriptlerParameterDefinition.java:170)
at com.seitenbau.jenkins.plugins.dynamicparameter.BaseParameterDefinition.executeScript(BaseParameterDefinition.java:221)
at com.seitenbau.jenkins.plugins.dynamicparameter.BaseParameterDefinition.getScriptResultAsList(BaseParameterDefinition.java:117)
at com.seitenbau.jenkins.plugins.dynamicparameter.scriptler.ScriptlerChoiceParameterDefinition.getChoices(ScriptlerChoiceParameterDefinition.java:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.commons.jexl.util.PropertyExecutor.execute(PropertyExecutor.java:125)
at