收藏
回答

java申请退款接口,报错java.net.SocketException:

本人后端使用RestTemplate向微信服务端发送请求,统一下单接口打通,没有出现任何问题,但是在申请退款接口中,却直接请求失败,报异常,没有任何响应返回。

报错信息为:

org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://api.mch.weixin.qq.com/secapi/pay/refund": Unexpected end of file from server; nested exception is java.net.SocketException: Unexpected end of file from server

at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:744)

at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:670)

at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:579)

at com.luming.training.util.WXUtils.sendRefundRequest(WXUtils.java:268)

at com.luming.training.util.WXUtils.main(WXUtils.java:297)

Caused by: java.net.SocketException: Unexpected end of file from server

at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:851)

at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)

at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1587)

at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)

at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)

at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:347)

at org.springframework.http.client.SimpleClientHttpResponse.getRawStatusCode(SimpleClientHttpResponse.java:55)

at org.springframework.web.client.DefaultResponseErrorHandler.hasError(DefaultResponseErrorHandler.java:55)

at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:766)

at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:736)

... 4 more


网上查询信息,说问题的根源在服务器响应的设置中,但是并没有找到解决方法。




回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容