binarywang/WxJava · error · WxErrorException
-99
-99
Error message
请求access token失败:响应内容为空
What it means
Error "请求access token失败:响应内容为空" thrown in binarywang/WxJava.
Source
Thrown at weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpServiceOkHttpImpl.java:62
@Override
public String getAccessToken(boolean forceRefresh) throws WxErrorException {
if (!this.configStorage.isAccessTokenExpired() && !forceRefresh) {
return this.configStorage.getAccessToken();
}
synchronized (this.globalAccessTokenRefreshLock) {
//得到httpClient
OkHttpClient client = getRequestHttpClient();
//请求的request
Request request = new Request.Builder()
.url(String.format(this.configStorage.getApiUrl(GET_TOKEN), this.configStorage.getCorpId(),
this.configStorage.getCorpSecret()))
.get()
.build();
String resultContent;
try (Response response = client.newCall(request).execute()) {
if (response.body() == null) {
throw new WxErrorException("请求access token失败:响应内容为空");
}
resultContent = response.body().string();
} catch (IOException e) {
log.error(e.getMessage(), e);
throw new WxErrorException(e);
}
WxError error = WxError.fromJson(resultContent, WxType.CP);
if (error.getErrorCode() != 0) {
throw new WxErrorException(error);
}
WxAccessToken accessToken = WxAccessToken.fromJson(resultContent);
this.configStorage.updateAccessToken(accessToken.getAccessToken(),
accessToken.getExpiresIn());
}
return this.configStorage.getAccessToken();
}
View on GitHub (pinned to 1c43293a3c)
Solutions
- 检查 corpId 与 corpSecret 是否正确,以及网络是否能访问企业微信 token 接口。
- 排查代理、防火墙或超时配置导致的空响应,必要时捕获原始响应体排查。
When it happens
Trigger: Thrown at weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpServiceOkHttpImpl.java:62 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of binarywang/WxJava@1c43293a3c (2026-08-14).
Data as JSON: /api/errors/b9700e3344255cb0.
Report an issue: GitHub.