Spring Quartz *.QRTZ_LOCKS' doesn't exist
来源:互联网 发布:淘宝的ipad为什么便宜 编辑:程序博客网 时间:2024/06/05 08:27
在使用 Spring OpenSymphony Quartz 做计划任务时,遇到错误:
ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.SchedulerFactoryBean#0' defined in class path resource [applicationContext.xml]: Invocation of init method failed; 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 'zp60v1_db.QRTZ_LOCKS' doesn't exist [See nested exception: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'zp60v1_db.QRTZ_LOCKS' doesn't exist]]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean
....
开发环境:
JDK 1.6
GWT 2.0
SmartGwt pro 2.0
Hibernate 3.2
Spring 2.5
applicationContext.xml:
为了定时执行一项任务,设置了Quartz , 但是运行后异常" Failure obtaining db row lock: Table ‘hibernate.qrtz_locks’ doesn’t exist“,相信你肯定会感到困惑,甚至也许会奇怪为什么 SchedulerFactoryBean 和数据持久层有关。
原因:
事实上,这个异常是由于 Spring 的 autowire 属性引起的,SchedulerFactoryBean 类含有方法 : setDataSource. 因为autowire 属性使用了 autodetect , 并且也设置了 datasource 在项目中, spring 容器就自动将 dataSource 注入到SchedulerFactoryBean, 而SchedulerFactoryBean将从 dataSource 中查找计划任务。 但 dataSource 中并没有任务,因此抛出了异常。
幸运的是,当你知道了根本原因,就知道如何避免了。
解决方法:
不论 spring 的 default-autowire 设置为"autodetect " 还是 "byName" ,都会出现 *.QRTZ_LOCKS' doesn't exist
方法一: 不使用 default-autowire 属性;
方法二: 在不改变 spring default-autowire 属性的前提下, 给 SchedulerFactoryBean 设置 autowire="no"。
- Spring Quartz *.QRTZ_LOCKS' doesn't exist
- innodb tables doesn't exist?
- Mysql table '' doesn`t exist
- Software Doesn’t Really Exist
- 数据库备份 Mysql table '' doesn`t exist
- Android Studio Local path doesn't exist.
- 1146 - Table 'xxx.xxx' doesn't exist
- Mysql “Table 'mysql.servers' doesn't exist”
- Table 'database1.xxx' doesn't exist
- AndroidStudio_local path doesn't exist解决办法
- Android Studio - local path doesn't exist
- hibernate---Table 'XXX.XXX' doesn't exist
- mysql Table 'performance_schema.session_variables' doesn't exist
- Table ‘performance_schema.session_variables’ doesn’t exist
- Table 'performance_schema.session_variables' doesn't exist
- Table 'lesport.LE_USERINFO' doesn't exist
- eclipse提示db-record doesn't exist
- Navicat mysql 'mysql.proc' doesn't exist
- Java Socket 编程
- Java 并发学习
- 多选框选中后,输入框可用,包括多列输入框
- 【转】Symbian函数或类与头文件和LIB库对照表
- 传说中的利用SMB协议检测操作系统类型CODE
- Spring Quartz *.QRTZ_LOCKS' doesn't exist
- 100128 13个坏习惯让IT工作者中过劳(转)
- 用java编写多线程ftp断点下载文件程序
- PNG文件格式
- Sql Server排序规则的简介、选择、应用
- 变电站安防应用解决方案及典型成功案例
- 链接错误"unresolved external symbol _main"
- 选择Hibernate还是iBATIS?
- ubuntu ip dns