2011-10-09 28 views
1

下面的代碼:HTTPBuilder get方法與封閉參數返回MissingMethodException

def http = new HTTPBuilder('http://twitter.com/statuses/') 

http.get(path: 'user_timeline.json', 
    query: [id:'httpbuilder', count:5]) { resp, json -> 

    println resp.status 

    json.each { // iterate over JSON 'status' object in the response: 
     println it.created_at 
     println ' ' + it.text 
    } 
} 

爲什麼要例外呢?我使用從http://groovy.codehaus.org/modules/http-builder/doc/json.html相同的代碼,它應該可以工作。

+0

適合我的作品;你使用什麼版本的一切?另外,堆棧跟蹤/某些上下文也很有幫助。 –

+0

我認爲這可能是我的IDE的問題,我使用Spring Tool Suite 2.6。異常信息是它找不到方法public Object get(Map args,Closure responseClosure) – Xilang

回答

1

這是IDE的問題,Eclipse groovy插件不能很好地工作。