小编Sek*_*har的帖子

org.apache.http.impl.execchain.RequestAbortedException:请求中止

我在使用 apache http 客户端从我的 Web 应用程序对第​​三方系统进行 http 调用时遇到问题。我正在使用 http-core-4.4.4 和 http-client-4.5.1。此票证HTTPCORE-446表明死锁问题已解决,并在异常情况下正常终止线程。有没有人遇到过这个异常,对导致这个问题的原因以及如何解决这个问题有任何想法吗?

编辑:用于进行 http 调用的 Http 代码片段

 protected <ResponseObj> run() throws Exception {

    String uri = <target system uri>;
    HttpPost httpPost = new HttpPost(uri);
    final HttpEntity entity = <Built http entity obj>;
    httpPost.setEntity(entity);
    HttpClient client = HttpClientBuilder.create().build();
    try {
        final HttpResponse response = client.execute(httpPost);
        ResponseObj res = processResponse(response);

        return res;

    } catch (Exception e) {

        LOGGER.error(ERROR_CALLING_TARGET, e);
        throw new CustomException(e);
    }
}
Run Code Online (Sandbox Code Playgroud)

例外

org.apache.http.impl.execchain.RequestAbortedException: Request aborted
at     org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:193) ~[httpclient-4.5.1.jar:4.5.1] …
Run Code Online (Sandbox Code Playgroud)

java apache http

6
推荐指数
1
解决办法
2763
查看次数

标签 统计

apache ×1

http ×1

java ×1