Failure obtaining db row lock: Table 'noe.qrtz_locks' doesn't exist

来源:13-3 SpringBoot项目整合Activiti7.0

troylc

2024-11-06

我的mysql 是用docker运行的
docker run --restart=always -p 3306:3306 --name mysql8 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:8 --lower_case_table_names=1
从mysql查询也是设置了的
图片描述
但是运行工作流工程就报以下错误

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
22:27:42 ERROR Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean ‘quartzScheduler’; nested exception is org.springframework.scheduling.SchedulingException: Could not start Quartz Scheduler; nested exception is org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Table ‘noe.qrtz_locks’ doesn’t exist [See nested exception: java.sql.SQLSyntaxErrorException: Table ‘noe.qrtz_locks’ doesn’t exist]]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181)
at org.springframework.context.support.DefaultLifecycleProcessor.access200(DefaultLifecycleProcessor.java:54)atorg.springframework.context.support.DefaultLifecycleProcessor200(DefaultLifecycleProcessor.java:54) at org.springframework.context.support.DefaultLifecycleProcessor200(DefaultLifecycleProcessor.java:54)atorg.springframework.context.support.DefaultLifecycleProcessorLifecycleGroup.start(DefaultLifecycleProcessor.java:356)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155)
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:940)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:591)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:326)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300)
at com.noe.activiti.workflow.NoeWorkflowApplication.main(NoeWorkflowApplication.java:19)
Caused by: org.springframework.scheduling.SchedulingException: Could not start Quartz Scheduler; nested exception is org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Table ‘noe.qrtz_locks’ doesn’t exist [See nested exception: java.sql.SQLSyntaxErrorException: Table ‘noe.qrtz_locks’ doesn’t exist]]
at org.springframework.scheduling.quartz.SchedulerFactoryBean.start(SchedulerFactoryBean.java:803)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
… 15 common frames omitted
Caused by: org.quartz.SchedulerConfigException: Failure occured during job recovery.
at org.quartz.impl.jdbcjobstore.JobStoreSupport.schedulerStarted(JobStoreSupport.java:697)
at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:539)
at org.quartz.impl.StdScheduler.start(StdScheduler.java:142)
at org.springframework.scheduling.quartz.SchedulerFactoryBean.startScheduler(SchedulerFactoryBean.java:728)
at org.springframework.scheduling.quartz.SchedulerFactoryBean.start(SchedulerFactoryBean.java:800)
… 16 common frames omitted
Caused by: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Table ‘noe.qrtz_locks’ doesn’t exist
at org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.executeSQL(StdRowLockSemaphore.java:184)
at org.quartz.impl.jdbcjobstore.DBSemaphore.obtainLock(DBSemaphore.java:113)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3857)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.recoverJobs(JobStoreSupport.java:839)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.schedulerStarted(JobStoreSupport.java:695)
… 20 common frames omitted
Caused by: java.sql.SQLSyntaxErrorException: Table ‘noe.qrtz_locks’ doesn’t exist
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1003)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeQuery(DruidPooledPreparedStatement.java:228)
at org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.executeSQL(StdRowLockSemaphore.java:123)
… 24 common frames omitted

写回答

2回答

troylc

提问者

2024-11-07

quartz:
  job-store-type: jdbc
  jdbc:
    initialize-schema: always

配置文件中增加spring.quartz.jdbc.initialize-schema: always 就可以成功启动了

1
0

troylc

提问者

2024-11-06

和其它同学提的问题一样,我看说是需要设置不区分大小写lower_case_table_names=1,但是我的mysql已经设置了不区分大小写启动工作流项目,还是报错。

0
0

SpringBoot+Vue3 项目实战,打造企业级在线办公系统

以业务为基础,贯穿前后端技术栈,获得企业级项目开发经验

2231 学习 · 1261 问题

查看课程