alibaba/canal · critical · IllegalArgumentException
canal.adminUser is empty , pls check https://github.com/alib
Error message
canal.adminUser is empty , pls check https://github.com/alibaba/canal/issues/4941
What it means
Thrown during Spring web context initialization when the `canal.adminUser` configuration property resolves to an empty string. WebConfig.addInterceptors() runs at startup and rejects an empty user before registering the auth interceptor, failing the bean wiring fast.
Source
Thrown at admin/admin-web/src/main/java/com/alibaba/otter/canal/admin/config/WebConfig.java:40
/**
* 相关MVC拦截器配置
*
* @author rewerma 2019-07-13 下午05:12:16
* @version 1.0.0
*/
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Value(value = "${canal.adminUser}")
private String user;
@Value(value = "${canal.adminPasswd}")
private String passwd;
@Override
public void addInterceptors(InterceptorRegistry registry) {
if (StringUtils.isEmpty(user)) {
throw new IllegalArgumentException(
"canal.adminUser is empty , pls check https://github.com/alibaba/canal/issues/4941");
}
if (StringUtils.isEmpty(passwd)) {
throw new IllegalArgumentException(
"canal.adminPasswd is empty , pls check https://github.com/alibaba/canal/issues/4941");
}
registry.addInterceptor(new HandlerInterceptor() {
@Override
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse,
Object o) throws Exception {
httpServletResponse.setHeader("Access-Control-Allow-Origin", "*");
httpServletResponse.setHeader("Access-Control-Allow-Methods", "*");
httpServletResponse.setHeader("Access-Control-Allow-Headers",
"Origin, X-Requested-With, Content-Type, Accept, Authorization, X-Token");
httpServletResponse.setHeader("Access-Control-Allow-Credentials", "true");View on GitHub (pinned to 87be50e876)
Solutions
- Set `canal.adminUser` in application.yml (e.g. canal.adminUser: admin) or pass -Dcanal.adminUser=admin on the JVM command line.
- Verify the property is loaded from the right profile and not shadowed by an empty spring profile value.
- Check the deployment's startup script / Docker env to ensure CANAL_ADMIN_USER (or the mapped env var) is exported.
- Cross-check against the GitHub issue #4941 referenced in the message for the canonical setup steps.
Example fix
// before (application.yml missing or empty) canal: adminUser: "" // after canal: adminUser: admin adminPasswd: your-password
Defensive patterns
Strategy: validation
Validate before calling
// Before starting the app, assert the property is set
if (org.apache.commons.lang.StringUtils.isBlank(System.getProperty("canal.adminUser"))) {
throw new IllegalStateException("canal.adminUser must be set before startup");
} Prevention
- Add a startup health-check that fails fast on missing canal.adminUser.
- Document required properties in the deployment runbook.
- Use Spring's @Value with a default only if an empty user is ever intentional (it is not here).
When it happens
Trigger: Starting the canal-admin web application (Spring Boot) with `canal.adminUser` unset, empty, or missing from application.yml/application.properties. The @Value("${canal.adminUser}") injection yields an empty string and addInterceptors() throws.
Common situations: Fresh deployment without copying canal_manager.sql-backed config; env var not exported in the run script; properties file uses a different key name; adminUser overridden to blank in a profile.
Related errors
- canal.adminPasswd is empty , pls check https://github.com/al
- clusterId and serverId are all empty
- No clickhouse adapter found for config key: {}
- ERROR Config: {} {}
- ERROR load Config: {} {}
AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14).
Data as JSON: /api/errors/5471cd09bdabd680.
Report an issue: GitHub.