Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Groovy RESTClient returns error #3152

sy00.hwang ·
Hi.

I'd like to use RESTClient(groovyx.net.http.RESTClient) in my step.

When I create RESTClient instance, it returns error with below.
Could anyone help?

(I already include below jar files at /plugins/com.pmease.quickbuild.libs/ )
apache-collections-commons-collections-3.1.jar apache-httpcomponents-httpcore.jar httpclient-4.2.jar json-lib.jar
apache-httpcomponents-httpclient.jar http-builder-0.7.3-20140519.065827-1.jar xml-resolver-1.2.jar



groovy:
import groovyx.net.http.RESTClient
import static groovyx.net.http.ContentType.*

def test = new groovyx.net.http.RESTClient("http://www.someurl.com")
def resp = test.get( path : "/rest/resource")

println resp.data.text
assert resp.status == 200
assert resp.contentType == XML.toString()


ERROR - Step 'master> stage>Test Groovy HTTP' is failed: java.lang.NoClassDefFoundError: groovy/lang/Closure
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2615)
at java.lang.Class.getDeclaredMethods(Class.java:1860)
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 script14265050634661945325700.run(script14265050634661945325700.groovy:5)
  • replies 1
  • views 1738
  • stars 0
robinshen ADMIN ·
This is more a groovy script issue instead of QB one. QB does not need any specific jars to use the RESTful API. You may test it with curl first to make sure it works.