由于: java.net.SocketException: 服务器意外关闭连接,引起了问题。

14

我通过SOAP UI运行WS时,经常会遇到以下错误。有时它不起作用,然后它继续工作,然后有时它又不起作用了。另一个问题是,客户提供的测试Web服务没有问题,但一旦我们切换到生产环境,就会出现问题。我在Google上搜索并进行了一些更改(HttpConfig超时,jetty maxIdleTime),但仍然无法使其正常工作:( 有什么方法可以缩小问题范围?

org.apache.cxf.interceptor.Fault: Could not send Message.
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)[147:org.apache.cxf.cxf-api:2.6.0.redhat-60024]
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)[147:org.apache.cxf.cxf-api:2.6.0.redhat-60024]

Caused by: java.net.SocketException: SocketException invoking https://www.website:443/gateway/ServicePortV2: Unexpected end of file from server
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.7.0_25]



Caused by: java.net.SocketException: Unexpected end of file from server
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:718)[:1.7.0_25]
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:579)[:1.7.0_25]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1322)[:1.7.0_25]
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)[:1.7.0_25]
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)[:1.7.0_25]
    at org.apache.cxf.transport.http.HTTPConduit.processRetransmit(HTTPConduit.java:1004)[159:org.apache.cxf.cxf-rt-transports-http:2.6.0.redhat-60024]
    at org.apache.cxf.transport.http.HTTPConduit.access$400(HTTPConduit.java:148)[159:org.apache.cxf.cxf-rt-transports-http:2.6.0.redhat-60024]
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRetransmits(HTTPConduit.java:1504)[159:org.apache.cxf.cxf-rt-transports-http:2.6.0.redhat-60024]
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1525)[159:org.apache.cxf.cxf-rt-transports-http:2.6.0.redhat-60024]
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1438)[159:org.apache.cxf.cxf-rt-transports-http:2.6.0.redhat-60024]

只需要补充说明在生产端点使用SOAP UI是可行的。


你是否向生产系统发送了非常大的消息?这似乎是一个接收超时问题。 - Willem Jiang
请求仅包含名称和ID,因此并不大。响应有时会很大。 - Samar
即使对于大型响应,使用uat url时具有相同的参数(超时等),也可以完美地工作。 - Samar
你能确认在传输层中没有中断吗?尝试连续ping服务器,以查看传输过程中是否有任何中断(如请求超时) - kolossus
服务器端表示他们没有看到任何错误/异常。这是否意味着请求根本没有到达他们?那么这是客户端问题吗? - Samar
显示剩余3条评论
1个回答

12

我们终于发现服务器端设置了连接超时时间,因此我们的保持活动连接将在分配的时间后超时,从而导致间歇性错误。将连接更改为每次关闭,现在一切正常。


1
嗨!我遇到了同样的问题,请问您能否解释一下您的解决方案? - Jose
解决方案是确保不保持连接(默认)。在每个请求/响应后将其设置为关闭。 - Samar
2
将 keep-alive 设置为 false,可以通过在启动时将网络属性 -Dhttp.keepAlive=false 设置为 VM 参数来完成,例如 java -Dhttp.keepalive=false... - user3792852

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接