gpt4 book ai didi

java - 具有长请求的 Apache CXF 客户端 "connection reset"

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

我有一个 SOAP 网络服务。

当从 SoapUI 调用它时,无论消息内容的大小如何,请求都运行良好。

如果我从 Apache CXF 客户端代码发出相同的请求,它可以处理小请求,但如果我的消息内容太长,我会收到“连接重置”,但有以下异常(exception)情况:

Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at com.sun.net.ssl.internal.ssl.InputRecord.readFully(Unknown Source)
at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1606)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1532)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1440)
... 37 more

关于什么可能导致它或如何调试它的任何想法?

最佳答案

问题是由 chunking mechanism 引起的当请求大小超过阈值并且服务器端不支持时,CXF 会启用它。

这个分块可以是disabled programmatically但是 CXF 中有一个错误导致 programmatic configuration is not taken into account in case of SSL connection .

解决方案是通过 spring configuration file 禁用分块.

关于java - 具有长请求的 Apache CXF 客户端 "connection reset",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24043279/

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