2011-03-03 30 views
1

我試圖使用LocalTask​​ExecutorThreadPool與石英,但是當我嘗試使用它作爲石英taskexecutor我得到這個錯誤。使用Spring的LocalTask​​ExecutorThreadPool與石英

ERROR:

arg.springframework.beans.TypeMismatchException:未能 類型的屬性值轉換[org.springframework.scheduling.quartz.LocalTask​​ExecutorThreadPool]至所需的類型[org.springframework.core.task.TaskExecutor ]屬性'taskExecutor'。

Spring配置

<bean id="taskExecutor" class="org.springframework.scheduling.quartz.LocalTaskExecutorThreadPool"> 

</bean> 

<bean id="schedulerTarget" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" scope="singleton" lazy-init="false"> 
    <property name="applicationContextSchedulerContextKey"> 
     <value>applicationContext</value> 
    </property> 
    <property name="dataSource"> 
     <ref bean="dataSrcBean"/> 
    </property> 
    <property name="transactionManager"> 
     <ref bean="txManager" /> 
    </property> 
    <property name="taskExecutor"> 
     <ref bean="taskExecutor" /> 
    </property> 
    <property name="quartzProperties"> 
     <props> 
      <prop key="org.quartz.jobStore.class">org.springframework.scheduling.quartz.LocalDataSourceJobStore</prop> 
      <prop key="org.quartz.jobStore.tablePrefix">QRTZ_</prop> 
      <prop key="org.quartz.jobStore.driverDelegateClass">org.quartz.impl.jdbcjobstore.MSSQLDelegate</prop> 
      <prop key="org.quartz.jobStore.selectWithLockSQL">SELECT * FROM {0}LOCKS WHERE LOCK_NAME = ?</prop> 
      <prop key="org.quartz.plugin.shutdownhook.class">org.quartz.plugins.management.ShutdownHookPlugin</prop> 
      <prop key="org.quartz.plugin.shutdownhook.cleanShutdown">true</prop> 
      <prop key="org.quartz.scheduler.instanceName">Sched1</prop> 
      <prop key="org.quartz.scheduler.instanceId">1</prop> 
      <prop key="org.quartz.scheduler.rmi.export">false</prop> 
      <prop key="org.quartz.scheduler.rmi.proxy">false</prop> 
     </props> 
    </property> 
</bean> 

這樣做的整個目的是讓Spring控制任何連接石英使。我已經有一個Spring事務管理器被調度器使用,但它看起來調度器會在我的數據庫上留下睡眠連接。

Thnaks

回答

2

,則不應使用LocalTaskExecutorThreadPool自己 - SchedulerFactoryBean使用這個內部對石英的ThreadPool接口緊裹TaskExecutor

SchedulerFactoryBean預計需要注入一個taskExecutor對象。您需要決定要使用的TaskExecutor的哪個實施。

+0

感謝您的幫助 – drobson