spring+quartz报错:Table 'XXXX.QRTZ_TRIGGERS' doesn't exist
Spring4.3.4 + quartz2.2.1配置到application.xml中
<properties>
<spring.version>4.3.4.RELEASE</spring.version>
</properties> <dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.1</version>
</dependency>
报错如下
Caused by: org.quartz.JobPersistenceException: Couldn't retrieve trigger: Table 'TEST.QRTZ_TRIGGERS' doesn't exist [See nested exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'BANKSTEELERP_OLD.QRTZ_TRIGGERS' doesn't exist]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1533)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$12.execute(JobStoreSupport.java:1522)
at org.quartz.impl.jdbcjobstore.JobStoreCMT.executeInLock(JobStoreCMT.java:245)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeWithoutLock(JobStoreSupport.java:3723)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1519)
at org.quartz.core.QuartzScheduler.getTrigger(QuartzScheduler.java:1530)
at org.quartz.impl.StdScheduler.getTrigger(StdScheduler.java:508)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:196)
... 59 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'TEST.QRTZ_TRIGGERS' doesn't exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
at com.mysql.jdbc.Util.getInstance(Util.java:382)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3593)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3525)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1986)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2140)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2111)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2273)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeQuery(DruidPooledPreparedStatement.java:210)
at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectTrigger(StdJDBCDelegate.java:1761)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1531)
... 70 more
spring.xml:文件中:
<beans .... default-autowire="byName">
<!-- Execution timing task -->
<!-- The business object -->
<bean id="bizObject" class="com.gmq.quartz.utils.JobTask" /> <!-- Dispatch services -->
<bean id="jobDetail"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="bizObject" />
<property name="targetMethod" value="doBiz" />
</bean> <!-- quartz-2.x configuration triggers increased scheduling -->
<bean id="cronTrigger"
class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="jobDetail" />
<property name="cronExpression" value="0 */1 * * * ?" />
</bean> <!-- Setting Scheduling -->
<bean name="startQuertz" lazy-init="false"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronTrigger" />
</list>
</property>
</bean>
</beans>
我的文件中的配置如上,报错如上。
经过调查:
<bean name="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
加入autowire="no": 加上这句,不自动织入。
原因如下:
在<Beans>中不能够设置default-autowire="byName"的属性,必须去掉,否则后台会报table or view does not exist错误,这就是autowire自动装配引起的。表示quartz会使用数据库记录job的状态而进行维护,但是这些日志表又不存在,从而引发错误。autowire自动装配会自动调用dataSource这个bean(hibernate配置的这个bean),但是数据库中又没有相应记录job的表,这就是报这个错误的原因
spring+quartz报错:Table 'XXXX.QRTZ_TRIGGERS' doesn't exist的更多相关文章
- spring+quartz报错:Table 'BANKSTEELERP_OLD.QRTZ_TRIGGERS' doesn't exist
spring3.2.8 + quartz2.2.1配置到application.xml中 org.springframework.beans.factory.BeanCreationException ...
- spring整合quartz报错
今天spring整合quartz报错,最后一步步排查,发现是和redis依赖冲突,最后redis升级了一下,问题解决. 总结:发现问题,逐一排查,如果是整合问题,报类加载不到的错误,大概率是和其他组件 ...
- 解决eclipse spring配置报错:cvc-elt.1: Cannot find the declaration of element
解决eclipse spring配置报错:cvc-elt.1: Cannot find the declaration of element 'beans'.Referenced file conta ...
- Spring Boot报错 MultipartException The temporary upload...
Spring Boot报错:尤其是在处理Ribbon这类接口调用型的负载均衡组件,常见问题 ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.se ...
- Spring Boot 报错记录
Spring Boot 报错记录 由于新建的项目没有配置数据库连接启动报错,可以通过取消自动数据源自动配置来解决 解决方案1: @SpringBootApplication(exclude = Dat ...
- Spring.之.报错:Caused by: java.lang.IllegalArgumentException: No Spring Session store is configured: set the 'spring.session.store-type' property
Spring.之.报错 No Spring Session store is configured springboot在启动的时候报如下错误: Error starting ApplicationC ...
- quartz 报错:java.lang.classNotFoundException
最近在做一个调度平台改造的项目,quartz在测试环境跑的是单机环境,生产上两台服务器做集群. 测试环境是ok的,生产上线后报错,一个类java.lang.classNotFoundException ...
- 启动Spring boot报错:nested exception is java.sql.SQLException: Field 'id' doesn't have a default value
先看具体日志: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with n ...
- 执行quartz报错java.lang.NoClassDefFoundError: javax/transaction/UserTransaction
使用maven ,可以在 http://mvnrepository.com 中去查找 pom 配置如何写 <!-- https://mvnrepository.com/artifact/org. ...
随机推荐
- pgsql restart
/etc/init.d/postgresql restart
- Jenkins:管理节点
Jenkins 管理节点 是管理所有即将在其上执行任务(JOB)的slave机器,包括各种OS类型的主机,都可以作为节点,因为Jenkins是java实现的,所以能安装JVM的OS都可以作为Jenki ...
- zookeeper和dubbo的关系
Dubbo建议使用Zookeeper作为服务的注册中心. 1. Zookeeper的作用: zookeeper用来注册服务和进行负载均衡,哪一个服务由哪一个机器来提供必需让调用者知 ...
- python使用xlrd 操作Excel读写
此文章非本人 一.安装xlrd模块 到python官网下载http://pypi.python.org/pypi/xlrd模块安装,前提是已经安装了python 环境. 二.使用介绍 1.导入模块 i ...
- avalon2学习教程02之vm
avalon2的vm是一个非常重要的东西,其设计原型最初脱胎于knockout.js,但到avalon1.6中,终于寻得自己的方案,更精简,更易用,更魔幻. vm是一种特殊的数据结构,看起来像普通对象 ...
- DBCC维护语句语法
一.DBCC维护语句:对数据库.索引或文件组进行维护的任务--1.DBCC CLEANTABLE,回收删除的可变长度列和文本列的空间 DBCC CLEANTABLE ( { 'database_na ...
- 吴裕雄 python深度学习与实践(2)
#coding = utf8 import threading,time,random count = 0 class MyThread (threading.Thread): def __init_ ...
- 吴裕雄 python 机器学习-DMT(1)
import numpy as np import operator as op from math import log def createDataSet(): dataSet = [[1, 1, ...
- 吴裕雄 oracle 函数、触发器和包编程
- “2017面向对象程序设计(Java)第十一周学习总结”存在问题的反馈及教学安排
“2017面向对象程序设计(Java)第十一周学习总结”存在问题的反馈及教学安排1.“提出表扬的同学:姜依萍,王雪玲,徐楠,相文君,赵晓未提交作业的同学:任红强,王瑞强,宗鹏新,扎西才让,布旦刀杰,范 ...