RequestAbortedException when using HttpClient but same request works in PostMan

Viewed 11

I have the following method through which I call an endpoint.

public void executeDQLLoad1() {
        try {
            HttpPost request = new HttpPost("http://myserver.com:80/mytable/query?__timeout=5000");
            StringEntity body = new StringEntity("myBody");
            request.setEntity(body);
            SimpleResponsePayload httpresponse = this.httpClient.execute(request);
            System.out.println(httpresponse.getPayload());
        } catch (Exception ex) {
            System.out.println("Exception occurred: " + ex);
        }
    }

When I run the above code, I get the following exception:

org.apache.http.impl.execchain.RequestAbortedException: Request execution failed
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_332]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_332]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_332]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_332]
at java.lang.Thread.run(Thread.java:750) [?:1.8.0_332]

There's also the following exception in the trace:

Caused by: java.util.concurrent.CancellationException: Operation aborted

Would appreciate any advice on how I can debug this. When I copy paste the same url and message body into Postman, the request succeeds.

0 Answers
Related