泽西岛SocketException:连接重置

时间:2018-07-05 11:08:22

标签: java rest jersey httpurlconnection jersey-client

客户端C使用带有Java8的Jersey 2.22.2与服务器S建立其余连接。客户端收到以下异常。

javax.ws.rs.Proce`enter code here`ssingException: java.net.SocketException: Connection reset
    at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:287) ~[jersey-client.jar:?]
    at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:255) ~[jersey-client.jar:?]
    at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:684) ~[jersey-client.jar:?]
    at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:681) ~[jersey-client.jar:?]
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[jersey-common.jar:?]
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297) ~[jersey-common.jar:?]
    at org.glassfish.jersey.internal.Errors.process(Errors.java:228) ~[jersey-common.jar:?]

Caused by: java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:210) ~[?:1.8.0_144]
    at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[?:1.8.0_144]
    at sun.security.ssl.InputRecord.readFully(InputRecord.java:465) ~[?:1.8.0_144]
    at sun.security.ssl.InputRecord.read(InputRecord.java:503) ~[?:1.8.0_144]
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385) ~[?:1.8.0_144]

从几篇博文中,我读到由于服务器关闭连接而导致客户端ACK失败(旧连接),因此发生了连接重置。

我看到默认的jersey客户端使用httpurlconnection。每次建立新连接还是使用连接池? 这可能是由于服务器或客户端每次都与服务器建立新的(TCP)连接时服务器或客户端的keepalive配置不正确造成的吗?

有人遇到这个问题吗?还有什么其他原因?任何线索将不胜感激。

0 个答案:

没有答案