我正在運行Grails 1.3.7;我有服務器A需要在服務器B上發出POST請求。我正在使用http-builder庫來發出這些請求。請求似乎是正確組成groovy在哪裏groovy.json.JsonSlurper 1.7.8
RESTClient http = new RESTClient(searchServerUrl);
Map body = ...;
logger.trace("request: ${request}, body: ${body}")
def response = http.post(path: request, body: body, requestContentType: URLENC)
logger.trace("response: ${response}");
return response;
服務器B正確地進行計算,並在服務器A試圖解析它返回一個JSON結構,服務器A,我看到異常的長期堆在這裏紮根:
Caused by: java.lang.NoClassDefFoundError: groovy/json/JsonSlurper
at groovyx.net.http.ParserRegistry.parseJSON(ParserRegistry.java:280)
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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
... 145 more
EDITED 的http-builder
庫帶有其dependencies
文件夾groovy-1.8.8.jar
,但我寧願使用隨我的Grails運行標準的Groovy庫(訴1.7.8)。不幸的是,groovy.json
命名空間似乎並不存在。我該怎麼辦?