Reputation: 111
I'm using the following script to do a Rest call. I have it working on another Jenkins rig and am now improving the script to make it reusable on another rig, but I'm getting an exception thrown. The code I'm having an issue with is the following. It looks like it's blowing up on the "new HTTPBuilder()" construction, but I can't figure out why:
public postTestRun(Map rp) {
def writer = new StringWriter()
def bldr = new groovy.xml.MarkupBuilder(new StringWriter())
def http = new HTTPBuilder(restUrl)
bldr.getMkp().xmlDeclaration(version: "1.0", encoding: "UTF-8", standalone: "yes")
bldr.Entity(Type: "run") {
The stack trace I'm getting is as follows:
FATAL: groovy/lang/Closure java.lang.NoClassDefFoundError: groovy/lang/Closure at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getDeclaredMethods(Unknown Source) at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:84) at java.security.AccessController.doPrivileged(Native Method) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) at groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:307) at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:286) at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2936) at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:166) at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:182) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:227) at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:751) at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:71) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:54) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190) at Utms.postTestRun(Utms.groovy:21) at Utms$postTestRun.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at JenkinsTestLogger.logTestResult(JenkinsTestLogger.groovy:56) at JenkinsTestLoggerIf$logTestResult.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at Script1.run(Script1.groovy:37) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:650) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:636) at hudson.plugins.groovy.SystemGroovy.perform(SystemGroovy.java:98) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:756) at hudson.model.Build$BuildExecution.build(Build.java:198) at hudson.model.Build$BuildExecution.doRun(Build.java:159) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529) at hudson.model.Run.execute(Run.java:1706) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:232) Caused by: java.lang.ClassNotFoundException: groovy.lang.Closure at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 44 more
Upvotes: 2
Views: 1171
Reputation: 111
Problem Solved, Use a non-system Groovy Script and specify the Groovy version to use.
Upvotes: 2