Skip to content

4.7.5.B postV3WithWechatpaySerial会报 Connection pool shutdown #3576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kknd9819 opened this issue May 12, 2025 · 1 comment · Fixed by #3578
Closed

4.7.5.B postV3WithWechatpaySerial会报 Connection pool shutdown #3576

kknd9819 opened this issue May 12, 2025 · 1 comment · Fixed by #3578

Comments

@kknd9819
Copy link

kknd9819 commented May 12, 2025

简要描述

老商家转账在发起转账请求的时候会报connection pool shutdown

模块版本情况

  • WxJava 模块名: wexin-java-pay
  • WxJava 版本号: 4.7.5.B

详细描述

对比之前的4.7.3.B版本,发现WxPayServiceApacheHttpImpl.java 第145行有区别,
try (CloseableHttpClient httpClient = this.createApiV3HttpClient();
是不是httpClient被自动关闭导致的

  public String postV3WithWechatpaySerial(String url, String requestStr) throws WxPayException {
    HttpPost httpPost = this.createHttpPost(url, requestStr);
    this.configureRequest(httpPost);
    try (CloseableHttpClient httpClient = this.createApiV3HttpClient();
         CloseableHttpResponse response = httpClient.execute(httpPost)) {
      //v3已经改为通过状态码判断200 204 成功
      int statusCode = response.getStatusLine().getStatusCode();
      String responseString = "{}";
      HttpEntity entity = response.getEntity();
      if (entity != null) {
        responseString = EntityUtils.toString(entity, StandardCharsets.UTF_8);
      }

      if (HttpStatus.SC_OK == statusCode || HttpStatus.SC_NO_CONTENT == statusCode) {
        this.logRequestAndResponse(url, requestStr, responseString);
        return responseString;
      }

      //有错误提示信息返回
      JsonObject jsonObject = GsonParser.parse(responseString);
      throw convertException(jsonObject);
    } catch (Exception e) {
      this.logError(url, requestStr, e);
      throw (e instanceof WxPayException) ? (WxPayException) e : new WxPayException(e.getMessage(), e);
    } finally {
      httpPost.releaseConnection();
    }
  }


### 日志
com.github.binarywang.wxpay.exception.WxPayException: Connection pool shut down
at com.github.binarywang.wxpay.service.impl.WxPayServiceApacheHttpImpl.postV3WithWechatpaySerial(WxPayServiceApacheHttpImpl.java:165)
at com.github.binarywang.wxpay.service.impl.MerchantTransferServiceImpl.createTransfer(MerchantTransferServiceImpl.java:35)
at com.infypower.fycev.payment.service.impl.PaymentWechatServiceImpl.createTransfer(PaymentWechatServiceImpl.java:212)
at com.infypower.fycev.pay.job.JobMerchantTransferStatus.retryMerchantTransfer(JobMerchantTransferStatus.java:108)
at com.infypower.fycev.pay.job.JobMerchantTransferStatus.checkStatus(JobMerchantTransferStatus.java:96)
at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.xxl.job.core.handler.impl.MethodJobHandler.execute(MethodJobHandler.java:31)
at com.xxl.job.core.thread.JobThread.run(JobThread.java:166)
Caused by: java.lang.IllegalStateException: Connection pool shut down
at org.apache.http.util.Asserts.check(Asserts.java:34)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.requestConnection(PoolingHttpClientConnectionManager.java:269)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:176)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at com.github.binarywang.wxpay.v3.SignatureExec.executeWithSignature(SignatureExec.java:78)
at com.github.binarywang.wxpay.v3.SignatureExec.execute(SignatureExec.java:60)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
at com.github.binarywang.wxpay.service.impl.WxPayServiceApacheHttpImpl.postV3WithWechatpaySerial(WxPayServiceApacheHttpImpl.java:146)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant