Closed lianghuiyuan closed 5 years ago
注意看demo。。。
初始化执行器 换成 XxlJobSpringExecutor
我昨晚也被坑了好久~
@sunhao91 谢谢你! 确实是类实例化的问题。 首先确定依赖的xxl-job的版本是2.0.1及以上,然后正确初始化代码如下:
@Bean(initMethod = "start", destroyMethod = "destroy")
public XxlJobSpringExecutor xxlJobExecutor() {
logger.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port);
xxlJobSpringExecutor.setAppName(appname);
xxlJobSpringExecutor.setAdminAddresses(addresses);
xxlJobSpringExecutor.setLogPath(logpath);
xxlJobSpringExecutor.setAccessToken(accessToken);
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
return xxlJobSpringExecutor;
}
Which version of XXL-JOB do you using?
V2.0.2
Expected behavior
EXECUTOR xxl-job registry success
Actual behavior
EXECUTOR xxl-job registry error
Steps to reproduce the behavior
你好,我通过IDEA Maven打jar包,在服务器通过命令
nohup java -jar ./xxl-job-admin-2.0.2-SNAPSHOT.jar -Xmx128m &
部署, 端口映射的是8085,xxl-job-admin配置是:在IDEA中的EXECUTOR项目xxl-job配置是:
项目能够正常启动,同样的配置,使用
xxl-job-executor-sample-springboot
EXECUTOR可以在xxl-job-admin
中注册成功,但是使用我的项目EXECUTOR却在xxl-job-admin
中注册失败。我的项目xxl-job配置初始化代码
注册失败报错信息: