我正在尝试将带有 Spring Rest 模板的 POST 请求发送到某个 URL 并获取 java.net.SocketException:连接重置。
这是实际执行的代码片段:
ResponseEntity<Void> response = restOperations.exchange(eventLoggingHost, HttpMethod.POST, httpEntity, Void.class);
我得到以下异常:
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:210) ~[?:1.8.0_131]
at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[?:1.8.0_131]
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) ~[?:1.8.0_131]
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) ~[?:1.8.0_131]
at java.io.BufferedInputStream.read(BufferedInputStream.java:345) ~[?:1.8.0_131]
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:735) ~[?:1.8.0_131]
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678) ~[?:1.8.0_131]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1569) ~[?:1.8.0_131]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474) ~[?:1.8.0_131]
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) ~[?:1.8.0_131]
at org.springframework.http.client.SimpleClientHttpResponse.getRawStatusCode(SimpleClientHttpResponse.java:55) ~[spring-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
这可能是什么原因造成的?我已经阅读了一些关于封闭式套接字的内容,但我没有在这个级别上操作任何这些概念。
温温酱
相关分类