gpt4 book ai didi

java.io.IOException : Connection reset by peer' when using AsyncRestTemplate on weblogic server

转载 作者:行者123 更新时间:2023-11-30 02:18:02 27 4
gpt4 key购买 nike

我的 Springboot 应用程序部署在位于我的 vps 上的 weblogic 服务器上,当我运行打算调用另一个网站的 API 方法的方法时,我返回此错误:

java.util.concurrent.ExecutionException: java.io.IOException: Connection reset by peer
at java.util.concurrent.FutureTask.report(FutureTask.java:122) [na:1.8.0_144]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) [na:1.8.0_144]
at org.springframework.util.concurrent.FutureAdapter.get(FutureAdapter.java:81) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_144]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_144]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144]
Caused by: java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcherImpl.readv0(Native Method) ~[na:1.8.0_144]
at sun.nio.ch.SocketDispatcher.readv(SocketDispatcher.java:43) ~[na:1.8.0_144]
at sun.nio.ch.IOUtil.read(IOUtil.java:278) ~[na:1.8.0_144]
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:440) ~[na:1.8.0_144]
at weblogic.socket.NIOInputStream.readInternal(NIOInputStream.java:168) ~[com.oracle.weblogic.server.muxers.jar:12.2.1.3]
at weblogic.socket.NIOInputStream.read(NIOInputStream.java:110) ~[com.oracle.weblogic.server.muxers.jar:12.2.1.3]
at weblogic.socket.NIOInputStream.read(NIOInputStream.java:73) ~[com.oracle.weblogic.server.muxers.jar:12.2.1.3]
at weblogic.socket.JSSEFilterImpl.readFromNetwork(JSSEFilterImpl.java:508) ~[com.oracle.weblogic.server.muxers.jar:12.2.1.3]
at weblogic.socket.JSSEFilterImpl.read(JSSEFilterImpl.java:470) ~[com.oracle.weblogic.server.muxers.jar:12.2.1.3]
at weblogic.socket.JSSESocket$JSSEInputStream.read(JSSESocket.java:119) ~[com.oracle.weblogic.server.muxers.jar:12.2.1.3]
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) ~[na:1.8.0_144]
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) ~[na:1.8.0_144]
at java.io.BufferedInputStream.read(BufferedInputStream.java:345) ~[na:1.8.0_144]
at weblogic.net.http.MessageHeader.isHTTP(MessageHeader.java:310) ~[com.oracle.weblogic.net.jar:12.2.1.3]
at weblogic.net.http.MessageHeader.parseHeader(MessageHeader.java:232) ~[com.oracle.weblogic.net.jar:12.2.1.3]
at weblogic.net.http.HttpClient.parseHTTP(HttpClient.java:554) ~[com.oracle.weblogic.net.jar:12.2.1.3]
at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:688) ~[com.oracle.weblogic.net.jar:12.2.1.3]
at weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:42) ~[com.oracle.weblogic.net.jar:12.2.1.3]
at weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:1547) ~[com.oracle.weblogic.net.jar:12.2.1.3]
at org.springframework.http.client.SimpleBufferingAsyncClientHttpRequest$1.call(SimpleBufferingAsyncClientHttpRequest.java:94) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
at org.springframework.http.client.SimpleBufferingAsyncClientHttpRequest$1.call(SimpleBufferingAsyncClientHttpRequest.java:77) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]
... 4 common frames omitted

我注意到,只有当我使用 Springs AsyncRestTemplate 调用 API 调用时才会发生这种情况。

ListenableFuture<ResponseEntity<String>> y = asyncRestTemplate.exchange(desiredUrl, HttpMethod.GET, new HttpEntity<>("result"), String.class);//.get().getBody();
boolean done = false;
while (done == false)
{
if (y.isDone() == true)
{
response = y.get().getBody();
return response;
}

}

} catch (InterruptedException | ExecutionException ex) {

Logger.getLogger(HTTP_Methods.class.getName()).log(Level.SEVERE, null, ex);
ex.printStackTrace();
}

最佳答案

错误

Connection reset by peer

是远程服务器(或它们之间的防火墙)的响应,表明它将不会继续完成此请求。

这很可能是防火墙拒绝、SSL 握手失败、代理问题甚至 HTTP 请求失败。

关于java.io.IOException : Connection reset by peer' when using AsyncRestTemplate on weblogic server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47692351/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com