{"record":{"id":"b9700e3344255cb0","repo":"binarywang/WxJava","slug":"99-b9700e","errorCode":"-99","errorMessage":"请求access token失败：响应内容为空","messagePattern":"请求access token失败：响应内容为空","errorType":"exception","errorClass":"WxErrorException","httpStatus":null,"severity":"error","filePath":"weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpServiceOkHttpImpl.java","lineNumber":62,"sourceCode":"  @Override\n  public String getAccessToken(boolean forceRefresh) throws WxErrorException {\n    if (!this.configStorage.isAccessTokenExpired() && !forceRefresh) {\n      return this.configStorage.getAccessToken();\n    }\n\n    synchronized (this.globalAccessTokenRefreshLock) {\n      //得到httpClient\n      OkHttpClient client = getRequestHttpClient();\n      //请求的request\n      Request request = new Request.Builder()\n        .url(String.format(this.configStorage.getApiUrl(GET_TOKEN), this.configStorage.getCorpId(),\n          this.configStorage.getCorpSecret()))\n        .get()\n        .build();\n      String resultContent;\n      try (Response response = client.newCall(request).execute()) {\n        if (response.body() == null) {\n          throw new WxErrorException(\"请求access token失败：响应内容为空\");\n        }\n        resultContent = response.body().string();\n      } catch (IOException e) {\n        log.error(e.getMessage(), e);\n        throw new WxErrorException(e);\n      }\n\n      WxError error = WxError.fromJson(resultContent, WxType.CP);\n      if (error.getErrorCode() != 0) {\n        throw new WxErrorException(error);\n      }\n      WxAccessToken accessToken = WxAccessToken.fromJson(resultContent);\n      this.configStorage.updateAccessToken(accessToken.getAccessToken(),\n        accessToken.getExpiresIn());\n    }\n    return this.configStorage.getAccessToken();\n  }\n","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/binarywang/WxJava/blob/1c43293a3c2c9d7e91304b6d037fb017f680d0c6/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpServiceOkHttpImpl.java#L44-L80","documentation":"Error \"请求access token失败：响应内容为空\" thrown in binarywang/WxJava.","triggerScenarios":"Thrown at weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpServiceOkHttpImpl.java:62 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["检查 corpId 与 corpSecret 是否正确，以及网络是否能访问企业微信 token 接口。","排查代理、防火墙或超时配置导致的空响应，必要时捕获原始响应体排查。"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1c43293a3c2c9d7e91304b6d037fb017f680d0c6","analyzedAt":"2026-08-14T02:29:11.060Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}