0

我是 Zone 面板 JFrame 的构造函数。我必须从服务器获取区域列表和运营商列表。我正在使用 HttpAsyncClient 库来转发我的请求。问题是在开始时我发送请求我的 1 个列表(即区域列表)它正在工作但是当我发送请求以获取 2 个列表时它给了我

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)

同样,如果我只发送请求(运营商列表)它工作正常但是......当我发送两个请求时它不起作用..这是我的请求发件人类...... public JSONArray sendRequest(List 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;
4

1 回答 1

0

尝试在您的项目中使用最新版本的 HttpComponents - http://hc.apache.org/downloads.cgi。构造函数

DefaultConnnectingIOReactor(IOReactorConfig) 

4.0 版中不存在,只有 4.2+。Apache HttpClient 正在尝试调用它,因此看起来 HttpClient 的版本需要 4.2+ 的 HttpComponents 版本。

于 2012-11-27T10:39:14.630 回答