spring quartz scheduler属性自动提交异常

时间:2012-12-04 17:27:34

标签: spring properties quartz-scheduler

我正在使用带有quartz schedular和spring-jdbc模板的maven-java-spring。

<dependency>
      <groupId>org.quartz-scheduler</groupId>
      <artifactId>quartz</artifactId>
      <version>1.7.3</version>
    </dependency>

我们有使用石英调度程序工作生成大量插入的过程。

当我在插入x个记录后执行作业时,它会抛出异常,如下所示

exception caught: org.springframework.transaction.TransactionSystemException: Could not commit JDBC transaction; nested exception is java.sql.SQLException: commit() should not be called while in auto-commit mode.
                at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCommit(DataSourceTransactionManager.java:270)
                at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
                at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
                at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:147)

以下是我的sechdular代码

<!-- Spring jobs -->
  <bean id="wireJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
    <property name="targetObject" ref="search"/>
    <property name="targetMethod" value="executeWireSearch"/>
  </bean>

  <bean id="nonWireJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
    <property name="targetObject" ref="search"/>
    <property name="targetMethod" value="executeNonWireSearch"/>
  </bean>



      <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
        <property name="triggers">
          <list>
            <ref bean="wireQuartzTrigger"/>
            <ref bean="nonWireQuartzTrigger"/>
          </list>
        </property>
      </bean>

与自动注册相关的石英属性有什么关系?

1 个答案:

答案 0 :(得分:0)

查看石英常见问题解答:http://quartz-scheduler.org/documentation/faq#FAQ-springCommit

顺便说一句,如果可能的话,你应该升级,因为1.7已经很老了,不再支持了

HIH