Exeption using Quartz integrates SchedulerFactoryBean
Hi, all
I'm getting this error trying to schedule some simple jobs using a SchedulerFactoryBean. Every thing goes well except that before I shutdown the sheduler. However, on shutdown, I get this error:
Code:
java.sql.SQLException: There is no DataSource named 'dummy'
at org.quartz.utils.DBConnectionManager.shutdown(DBConnectionManager.java:147)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.shutdown(JobStoreSupport.java:530)
at org.quartz.impl.jdbcjobstore.JobStoreCMT.shutdown(JobStoreCMT.java:157)
at org.quartz.core.QuartzScheduler.shutdown(QuartzScheduler.java:471)
at org.quartz.core.QuartzScheduler.shutdown(QuartzScheduler.java:434)
at org.quartz.impl.StdScheduler.shutdown(StdScheduler.java:176)
at gameshop.framework.quartz.DumbSchedulerFactory$1.doInTransactionWithoutResult(DumbSchedulerFactory.java:50)
at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:114)
at gameshop.framework.quartz.DumbSchedulerFactory.main(DumbSchedulerFactory.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
2004-10-3 1:21:55 org.quartz.impl.jdbcjobstore.JobStoreCMT shutdown
警告: Database connection shutdown unsuccessful.
java.sql.SQLException: There is no DataSource named 'dummy'
at org.quartz.utils.DBConnectionManager.shutdown(DBConnectionManager.java:147)
at org.quartz.impl.jdbcjobstore.JobStoreCMT.shutdown(JobStoreCMT.java:160)
at org.quartz.core.QuartzScheduler.shutdown(QuartzScheduler.java:471)
at org.quartz.core.QuartzScheduler.shutdown(QuartzScheduler.java:434)
at org.quartz.impl.StdScheduler.shutdown(StdScheduler.java:176)
at gameshop.framework.quartz.DumbSchedulerFactory$1.doInTransactionWithoutResult(DumbSchedulerFactory.java:50)
at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:114)
at gameshop.framework.quartz.DumbSchedulerFactory.main(DumbSchedulerFactory.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
2004-10-3 1:21:55 org.quartz.core.QuartzScheduler shutdown
信息: Scheduler QuartzScheduler_$_NON_CLUSTERED shutdown complete.
I looked through my codes and could't find anything named "dummy", so It must be a default setting somewhere
Here is my codesnippet:
Config File:
Code:
<beans>
<bean id="jobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>gameshop.framework.quartz.DumbJob</value>
</property>
</bean>
<bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail">
<ref local="jobDetail"/>
</property>
<property name="repeatCount">
<value>2</value>
</property>
<property name="repeatInterval">
<value>1</value>
</property>
</bean>
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="autoStartup">
<value>false</value>
</property>
<property name="applicationContextSchedulerContextKey">
<value>applicationContext</value>
</property>
<property name="waitForJobsToCompleteOnShutdown">
<value>true</value>
</property>
<property name="quartzProperties">
<props>
<!-- ThreadPool -->
<prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
<prop key="org.quartz.threadPool.threadCount">5</prop>
<prop key="org.quartz.threadPool.threadPriority">5</prop>
<!-- Job store -->
<prop key="org.quartz.jobStore.misfireThreshold">60000</prop>
<prop key="org.quartz.jobStore.class">org.quartz.impl.jdbcjobstore.JobStoreTX</prop>
<prop key="org.quartz.jobStore.driverDelegateClass">${jdbc.quartz.delegateClassName}</prop>
<prop key="org.quartz.jobStore.useProperties">false</prop>
<prop key="org.quartz.jobStore.selectWithLockSQL">
SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?
</prop>
<!-- Plugins -->
<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.plugin.triggHistory.class">
org.quartz.plugins.history.LoggingTriggerHistoryPlugin
</prop>
<prop key="org.quartz.plugin.triggHistory.triggerFiredMessage">
Trigger {1}.{0} fired job {6}.{5} at: {4, date, HH:mm:ss MM/dd/yyyy}
</prop>
<prop key="org.quartz.plugin.triggHistory.triggerCompleteMessage">
Trigger {1}.{0} completed firing job {6}.{5} at {4, date, HH:mm:ss MM/dd/yyyy} with resulting trigger instruction code: {9}
</prop>
</props>
</property> <!-- end of quartzProperties-->
<property name = "triggers">
<list>
<ref local = "simpleTrigger"/>
</list>
</property>
</bean>
</beans>
Test Code
Code:
public class DumbSchedulerFactory
{
public static void main(String[] args) throws SchedulerException, InterruptedException
{
Scheduler scheduler = (Scheduler) BeanLocator.getBean("scheduler");
scheduler.start();
Thread.sleep(10000);
scheduler.shutdown();
}
}
I found a post refered to the same problem! I did as his suggestion ,but maybe I missed something, it didn't work.
Here is the post:
http://forum.springframework.org/showthread.php?t=10118
Any suggestion and hints will be appreciated!
Regards.
Yoshiyan