问题描述
我要每个星期的周六晚上23:59分调用一个action。以前没用过,在网上看那个时间规则看半天也不懂。自己写出来一个,一启动就报错。谁来帮我解决一下啊<!-- 每周六晚上23:55调用一次mysql存储过程,更新统计记录 --><bean id="weekLsPlayerTaskAction" class="com.peuo.wl.task.WeekLsPlayerTaskAction"/> <bean id="weekLsPlayerTaskActionTask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject"> <ref bean="weekLsPlayerTaskAction"/> </property> <property name="targetMethod"> <value>doRun</value> </property></bean><bean id="weekLsPlayerActionTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail"> <ref bean="weekLsPlayerTaskActionTask"/> </property> <property name="cronExpression"> <!-- 每周六晚上23:55执行 --> <value>0 55 23 * * 6</value> </property></bean> <bean autowire="no"class="org.springframework.scheduling.quartz.SchedulerFactoryBean"><property name="triggers"><list><ref local="dayReportTaskActionTrigger" /><ref local="weekLsPlayerActionTrigger"/></list></property></bean> 问题补充:这是启动服务时报的错org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.SchedulerFactoryBean' defined in file [D:Program FilesTomcat 5.0webappssgsiWEB-INFclassesspringspring.task.cfg.xml]: Invocation of init method failed; nested exception is org.quartz.SchedulerException: Registration of jobs and triggers failed: Support for specifying both a day-of-week AND a day-of-month parameter is not implemented. [See nested exception: java.lang.UnsupportedOperationException: Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.]Caused by: org.quartz.SchedulerException: Registration of jobs and triggers failed: Support for specifying both a day-of-week AND a day-of-month parameter is not implemented. [See nested exception: java.lang.UnsupportedOperationException: Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.]at org.springframework.scheduling.quartz.SchedulerFactoryBean.registerJobsAndTriggers(SchedulerFactoryBean.java:789)at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:593)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1062)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1029)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:420)at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348)at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)at org.apache.catalina.core.StandardService.start(StandardService.java:480)at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)at org.apache.catalina.startup.Catalina.start(Catalina.java:556)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:601)at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)* Nested Exception (Underlying Cause) ---------------java.lang.UnsupportedOperationException: Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.at org.quartz.CronExpression.getTimeAfter(CronExpression.java:1234)at org.quartz.CronTrigger.getTimeAfter(CronTrigger.java:857)at org.quartz.CronTrigger.getFireTimeAfter(CronTrigger.java:587)at org.quartz.CronTrigger.computeFirstFireTime(CronTrigger.java:836)at org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:646)at org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:249)at org.springframework.scheduling.quartz.SchedulerFactoryBean.addTriggerToScheduler(SchedulerFactoryBean.java:840)at org.springframework.scheduling.quartz.SchedulerFactoryBean.registerJobsAndTriggers(SchedulerFactoryBean.java:770)at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:593)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1062)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1029)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:420)at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348)at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)at org.apache.catalina.core.StandardService.start(StandardService.java:480)at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)at org.apache.catalina.startup.Catalina.start(Catalina.java:556)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:601)at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
解决方案
这么写0 55 23 ? * 6
解决方案二:
CRON表达式,秒 分 时 日 月 年你的要求 :周六的23点55分应该是这样:0 55 23 * * ? SAT
解决方案三:
看看错误日志。或者把错误贴上来看下。