xuxueli/xxl-job · critical · RuntimeException

xxl-job executor accessToken empty.

Error message

xxl-job executor accessToken empty.

What it means

Thrown by XxlJobExecutor.start() when the accessToken field is blank. The access token must match between admin and executor for authenticated RPC; a blank token is rejected to prevent an unauthenticated registration path.

Source

Thrown at xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java:144

     * start
     */
    public void start() throws Exception {

        // valid enabled
        if (!enabled) {
            logger.info(">>>>>>>>>>> xxl-job executor start fail, enabled:{}", enabled);
            return;
        }

        // valid param
        if (StringTool.isBlank(adminAddresses)) {
            throw new RuntimeException("xxl-job executor adminAddresses empty.");
        }
        if (StringTool.isBlank(appname)) {
            throw new RuntimeException("xxl-job executor appname empty.");
        }
        if (StringTool.isBlank(accessToken)) {
            throw new RuntimeException("xxl-job executor accessToken empty.");
        }

        // bind instance
        xxlJobExecutor = this;

        // init logpath
        XxlJobFileAppender.initLogPath(logPath);

        // init invoker, admin-client
        initAdminBizList();

        // 1、init JobLogFileCleanThread
        jobLogFileCleanThreadHelper = new JobLogFileCleanThreadHelper();
        jobLogFileCleanThreadHelper.start(logRetentionDays);

        // 2、init TriggerCallbackThread
        triggerCallbackThreadHelper = new TriggerCallbackThreadHelper();
        triggerCallbackThreadHelper.start(this);

View on GitHub (pinned to e74c784f68)

Solutions

  1. Set xxl.job.accessToken (or setAccessToken) to a non-blank shared secret identical on admin and executor.
  2. Confirm the executor's token equals the admin's xxl.job.accessToken exactly.
  3. Inject the token via env var / secret store rather than hard-coding.

Example fix

// before
xxlJobExecutor.setAccessToken("");
// after
xxlJobExecutor.setAccessToken(System.getenv("XXL_JOB_ACCESS_TOKEN"));
Defensive patterns

Strategy: validation

Validate before calling

String token = config.getAccessToken();
if (StringTool.isBlank(token)) {
    throw new IllegalStateException("xxl.job.accessToken is required");
}

Try / catch

try {
    xxlJobExecutor.start();
} catch (RuntimeException e) {
    log.error("executor start failed: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling start() with accessToken unset or whitespace (e.g. xxl.job.accessToken not configured, or executor-side token differs from being set at all).

Common situations: xxl.job.accessToken missing from the executor's application.properties; token configured only on the admin side; env var not injected; migrating from a version that allowed empty tokens.

Related errors


AI-assisted analysis of xuxueli/xxl-job@e74c784f68 (2026-08-14). Data as JSON: /api/errors/4cc6069929780ed8. Report an issue: GitHub.