dromara/Sa-Token · error · NotImplException
10004
10004
Error message
HTTP 请求处理器未实现
What it means
SaHttpTemplateDefaultImpl is the placeholder outbound-HTTP implementation registered by sa-token-core. Its get(url) throws NotImplException (code 10004) to signal that no real HTTP client plugin was provided. Features that make server-side HTTP calls (e.g. OAuth2/SSO components fetching tokens or user info) hit this stub when the HTTP integration jar is absent.
Source
Thrown at sa-token-core/src/main/java/cn/dev33/satoken/http/SaHttpTemplateDefaultImpl.java:41
/**
* Http 请求处理器,默认实现类
*
* @author click33
* @since 1.43.0
*/
public class SaHttpTemplateDefaultImpl implements SaHttpTemplate {
public static final String ERROR_MESSAGE = "HTTP 请求处理器未实现";
/**
* get 请求
*
* @param url /
* @return /
*/
@Override
public String get(String url) {
throw new NotImplException(ERROR_MESSAGE).setCode(SaErrorCode.CODE_10004);
}
/**
* post 请求,form-data 格式参数
*/
@Override
public String postByFormData(String url, Map<String, Object> params) {
throw new NotImplException(ERROR_MESSAGE).setCode(SaErrorCode.CODE_10004);
}
}
View on GitHub (pinned to ac2c7f6e94)
Solutions
- Add an sa-token HTTP plugin dependency, e.g. sa-token-http-for-httpclient or sa-token-http-for-okhttp, matching your sa-token version
- Or register an implementation yourself at startup: SaManager.setSaHttpTemplate(new MySaHttpTemplate()) based on RestTemplate/WebClient/etc.
- Verify with SaManager.getSaHttpTemplate().getClass() that it is no longer SaHttpTemplateDefaultImpl before serving traffic
Example fix
<!-- before: no http plugin --> <dependency> <groupId>cn.dev33</groupId> <artifactId>sa-token-sso</artifactId> </dependency> <!-- after --> <dependency> <groupId>cn.dev33</groupId> <artifactId>sa-token-sso</artifactId> </dependency> <dependency> <groupId>cn.dev33</groupId> <artifactId>sa-token-http-for-httpclient</artifactId> <version>1.44.0</version> </dependency>
Defensive patterns
Strategy: validation
Validate before calling
if (SaManager.getSaHttpTemplate() instanceof SaHttpTemplateDefaultImpl) {
throw new IllegalStateException("Add an sa-token http plugin before SSO flows run");
} Try / catch
catch (NotImplException e) {
if (SaErrorCode.CODE_10004 == e.getCode()) { /* http plugin missing */ }
} Prevention
- Include sa-token-http-for-httpclient/okhttp whenever using SSO/OAuth2 modules
- Assert the registered template class at startup
- Keep plugin versions locked to the sa-token BOM
When it happens
Trigger: An SSO/OAuth2 client flow calls SaHttpTemplate.get(...) while only sa-token-core (or a starter without an http plugin) is on the classpath and SaManager.getSaHttpTemplate() still returns the default impl.
Common situations: Adding sa-token-sso but forgetting the httpclient/okhttp plugin dependency; environment without the plugin artifact; startup order where setSaHttpTemplate is called after first use.
Related errors
AI-assisted analysis of dromara/Sa-Token@ac2c7f6e94 (2026-08-14).
Data as JSON: /api/errors/4d2e55adddf548db.
Report an issue: GitHub.