jenkins发布服务失败查看catalina.out启动日志和xxl
jenkins发布服务失败查看catalina.out启动日志和xxl-job jobhandler naming conflicts
1.查看tomcat/logs/catalina.out 日志,发现和定位问题: Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2024-04-26 13:55:36.872 [localhost-startStop-1][orderCoreApi,,,] ERROR o.s.boot.SpringApplication#reportFailure [line:771] - Application startup failedorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxlJobExecutor' defined in class path resource [com/myProject/xxljob/XxlJobConfiguration.class]: Invocation of init method failed; nested exception is java.lang.RuntimeException: xxl-job jobhandler naming conflicts.
Caused by: java.lang.RuntimeException: xxl-job jobhandler naming conflicts.
2.如下代码,如果项目中存在“mySendSmsJobTask”重复,则会在项目启动的时候,报以上错误。
代码语言:javascript代码运行次数:0运行复制@Component
@JobHandler("mySendSmsJobTask")
public class MySendSmsJobTask extends IJobHandler {
private Logger logger = LoggerFactory.getLogger(MySendSmsJobTask.class);
@Override
public ReturnT<String> execute(String s) throws Exception {
Transaction t = Cat.getProducer().newTransaction(CatConstants.XXL_JOB_CALL, "定时查询 定时任务发送短信 定时任务");
try {
Cat.logEvent(CatConstants.XXL_JOB_METHOD,"MySendSmsJobTask.execute");
Cat.logEvent(CatConstants.XXL_JOB_PARAM,null);
logger.info("开始执行 定时任务发送短信 定时器");
XxlJobLogger.log("开始执行 定时任务发送短信 定时器");
//定时任务业务逻辑处理
logger.info("结束执行 定时任务发送短信 ");
XxlJobLogger.log("结束执行 定时任务发送短信 ");
t.setStatus(Transaction.SUCCESS);
return SUCCESS;
} catch (Exception e) {
XxlJobLogger.log("执行 定时任务发送短信 异常:" + e);
logger.error("执行 定时任务发送短信 异常",e);
Cat.logError("执行 定时任务发送短信 异常",e);
t.setStatus(e);
return new ReturnT(FAIL.getCode(),e.toString());
} finally {
if (t != null) {
tplete();
}
}
}
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。 原始发表:2024-05-22,如有侵权请联系 cloudcommunity@tencent 删除jenkinsnaming定时任务服务日志发布者:admin,转转请注明出处:http://www.yc00.com/web/1754971366a5223131.html
评论列表(0条)