ajjjian
2009-01-21 11:57
浏览 285
已采纳

struts2+spring2+hibernate3.2项目加上quartz出现错误

此前项目都是正常的。但加上quartz做定时任务时,启动Tomcat报错:
[code="java"]org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduler' defined in file [F:\apache-tomcat-5.5.20\webapps\gamepay\WEB-INF\classes\spring\applicationContext-time.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: 第 1 行: FOR UPDATE 子句仅允许用于 DECLARE CURSOR。 [See nested exception: com.microsoft.sqlserver.jdbc.SQLServerException: 第 1 行: FOR UPDATE 子句仅允许用于 DECLARE CURSOR。]][/code]

quartz的相关文件如下:
[code="java"]<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">

<bean id="payCheck"
    class="com.gamepay.common.PayStatusCheck" />

<!-- 定制任务 -->
<bean id="timerJob"
    class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"
    lazy-init="false">
    <property name="targetObject" ref="payCheck" />
    <property name="targetMethod" value="check" />
</bean>

<!-- 触发器-->
<bean id="timerTrigger"
    class="org.springframework.scheduling.quartz.CronTriggerBean"
    lazy-init="false">
    <property name="jobDetail">
        <ref local="timerJob" />
    </property>
    <property name="cronExpression">
        <value>0 * 0-23 * * ?</value>
    </property>

</bean>

<!-- 触发器调度控制器,启动 -->
<bean id="scheduler"
    class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
    lazy-init="false">
    <property name="triggers">
        <ref local="timerTrigger" />
    </property>
</bean>

[/code]

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • bohemia 2009-01-21 12:28
    最佳回答

    [quote]default-autowire="byName" [/quote]

    这个的问题? 还是DataSource配置的问题啊. 去掉试试看.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题