org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: ORA-00942: table or view

转载自:

http://hithoper.blog.hexun.com/44424458_d.html

今天在SPRING上配置一个QUARTZ来做定时任务,
配置好了,启动程序,老是报如下错误:

11:03:05,296 INFO [STDOUT] 02-22 11:03:05 [ERROR] org.springframework.web.context.ContextLoader initWebApplicationContext org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:211) - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SmsSendTaskFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext-quartz.xml]: Initialization of bean 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: ORA-00942: table or view does not exist
[See nested exception: java.sql.SQLException: ORA-00942: table or view does not exist
]]
org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: ORA-00942: table or view does not exist
[See nested exception: java.sql.SQLException: ORA-00942: table or view does not exist
]]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize(JobStoreSupport.java:493)
at org.quartz.impl.jdbcjobstore.JobStoreCMT.initialize(JobStoreCMT.java:144)


难道我的DAO里面的程序有问题,表名写错了?
原来是因为applicationContext-quartz.xml配置文件里面的
<beans default-autowire="byName">

<bean id="SmsSendTaskFactory"
   class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
   <property name="triggers">
    <list>
     <ref bean="messageTaskScheduledTask" />
    </list>
   </property>
   <property name="configLocation"
    value="classpath:quartz.properties" />
</bean>

看看SchedulerFactoryBean里面的源代码,它会用datasource连接数据库,去取数据库里面的任务,然后又找不到表名。所以报错。
看来这个autowire byName不能乱用啊。
把这个default-autowire="byName"去掉,老实的配置SPRING的BEAN就正确了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值