首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

quartz调用程序(2)

2012-10-26 
quartz调用程序(二)今天在SPRING上配置一个QUARTZ来做定时任务,配置好了,启动程序,老是报如下错误:11:03:0

quartz调用程序(二)
今天在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"
   />
    </list>
   </property>
   <property name="configLocation"
    value="classpath:quartz.properties" />
</bean>

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

热点排行