第一次用bladex (看官方文档就出不来那种). 1. 定时任务坑(xxljob) 明明已经按照文档书写: 创建一个类 .类中定义一个方法,方法上添加@XxlJob("xxx")在xxljob的服务
第一次用bladex (看官方文档就出不来那种).
明明已经按照文档书写:
@XxlJob("xxx")
xxx
job handler [xxx] not found.
package com.aiotxip.cotton.config;import com.xxl.job.core.executor.impl.XxlJobspringExecutor;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.beans.factory.annotation.Value;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;@Configurationpublic class XxlJobConfig {private final Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);@Value("${xxl.job.admin.addresses}")private String adminAddresses;@Value("${xxl.job.executor.appname}")private String appName;@Value("${xxl.job.executor.ip}")private String ip;@Value("${xxl.job.executor.port}")private int port;@Value("${xxl.job.accessToken}")private String accessToken;@Value("${xxl.job.executor.logpath}")private String logPath;@Value("${xxl.job.executor.logretentiondays}")private int logRetentionDays;@Beanpublic XxlJobSpringExecutor xxlJobExecutor() {logger.info(">>>>>>>>>>> xxl-job config init.");XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();xxlJobSpringExecutor.setAdminAddresses(adminAddresses);xxlJobSpringExecutor.setAppName(appName);xxlJobSpringExecutor.setIp(ip);xxlJobSpringExecutor.setPort(port);xxlJobSpringExecutor.setAccessToken(accessToken);xxlJobSpringExecutor.setLogPath(logPath);xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);return xxlJobSpringExecutor;}}
xxl: job: accessToken: '' admin: addresses: Http://localhost:7009/xxl-job-admin executor: appname: blade-xxljob ip: 127.0.0.1 logpath: ../data/applogs/xxl-job/jobhandler logretentiondays: -1 port: 7038
注意端口port不能和已有的冲突(可能其他服务也注册有)
3. 重启项目,执行,还是失败.(如果这一步已经成功了就无需往下看了).
因为我们定时任务对应的执行器不对.需要编辑我们的定时任务
4. 再次执行,执行成功.
来源地址:https://blog.csdn.net/weixin_42452726/article/details/127803097
--结束END--
本文标题: bladex定时任务job handler [xxx] not found解决
本文链接: https://lsjlt.com/news/410308.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0