2012-11-27 45 views
0

我是我的區域面板JFrame的構造函數。我必須從服務器獲取區域列表和操作員列表。我正在使用HttpAsyncClient庫來轉發我的請求。問題是,當在開始我爲我1名列表(即區列表)發送請求,這是工作,但是當我發出請求,請求得到2所列出它給的我HttpAsyncClient沒有得到多個請求

Exception in thread "AWT-EventQueue-0"  
java.lang.NoSuchMethodError:org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor. 
<init>(Lorg/apache/http/impl/nio/reactor/IOReactorConfig;)at  
org.apache.http.impl.nio.client.AbstractHttpAsyncClient.<init> 
(AbstractHttpAsyncClient.java:133) 
at org.apache.http.impl.nio.client.DefaultHttpAsyncClient.<init> 
(DefaultHttpAsyncClient.java:64) 

similirly如果我只(操作室列表發送請求)它工作正常,但...當我送了both..here要求它不工作是我的請求發送方類..... 公共JSONArray sendRequest將(名單postPairs){

try { 
     //At this line code gives me exception i do't know why..? 
     HttpAsyncClient httpclient = new DefaultHttpAsyncClient(); 
     httpclient.start(); 
     System.out.println(postPairs.get(0).getValue()); 
     HttpPost post = new HttpPost("http://10.0.0.62:8080/IDocWS/"+postPairs.get(0).getValue()); 
     //HttpPost post = new HttpPost("http://www.google.com"); 
     Future<HttpResponse> future = httpclient.execute(post, null); 
     HttpResponse resp = future.get(); 
     HttpEntity entity = resp.getEntity(); 
     JSONArray jArray = CovnertToJson(entity); 
     return jArray; 
+0

你使用的是什麼版本的Apache HTTP組件? –

+0

httpcomponents-asyncclient-4.0-beta3 –

回答

0

嘗試使用最新版本的HttpComponents與您的項目 - http://hc.apache.org/downloads.cgi。構造函數

DefaultConnnectingIOReactor(IOReactorConfig) 

僅在版本4.0中不存在4.2+。 Apache HttpClient試圖調用它,所以看起來HttpClient的版本需要HttpComponents的4.2+版本。