title: Spring: Couldn't get to the cause [java.lang.IllegalArgumentException: Range exceeds maximum (8): 2525]
body: <p>This is the first time I encountered with this problem and tried to get something out of it, but couldn't figure out the actual cause/solution for this. Any help regarding this would be of great help.</p>
  
  <pre><code>2013-09-26 00:26:52,657 [Thread-2] ERROR org.springframework.web.context.ContextLoader  - Context initialization failed
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.config.ScheduledTaskRegistrar#0': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Range exceeds maximum (8): 2525
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1422)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
          at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
          at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
          at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
          at com.qtl.everest.web.SpringContextLoaderListener.contextInitialized(SpringContextLoaderListener.java:74)
          at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
          at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
          at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
          at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
          at java.util.concurrent.FutureTask.run(FutureTask.java:138)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
          at java.lang.Thread.run(Thread.java:662)
  Caused by: java.lang.IllegalArgumentException: Range exceeds maximum (8): 2525
          at org.springframework.scheduling.support.CronSequenceGenerator.getRange(CronSequenceGenerator.java:334)
          at org.springframework.scheduling.support.CronSequenceGenerator.setNumberHits(CronSequenceGenerator.java:297)
          at org.springframework.scheduling.support.CronSequenceGenerator.setDays(CronSequenceGenerator.java:275)
          at org.springframework.scheduling.support.CronSequenceGenerator.parse(CronSequenceGenerator.java:241)
          at org.springframework.scheduling.support.CronSequenceGenerator.&lt;init&gt;(CronSequenceGenerator.java:81)
          at org.springframework.scheduling.support.CronTrigger.&lt;init&gt;(CronTrigger.java:54)
          at org.springframework.scheduling.support.CronTrigger.&lt;init&gt;(CronTrigger.java:44)
          at org.springframework.scheduling.config.ScheduledTaskRegistrar.afterPropertiesSet(ScheduledTaskRegistrar.java:129)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1479)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)
          ... 20 more
  </code></pre>
  
  <p><strong>EDIT: Cron statement</strong></p>
  
  <pre><code>&lt;task:scheduled-tasks scheduler="scheduler"&gt;
          &lt;!-- Update date filters each midnight +30 sec (to cover the time errors 
              of the scheduler) --&gt;
          &lt;task:scheduled ref="IndexGroupSearchersManager"
              method="updateDateFilterQueries" cron="30 0 0 * * ?" /&gt;
          &lt;!-- Send favorite search alerts once a week --&gt;
          &lt;task:scheduled ref="favoriteSearchAlertService"
              method="sendAlerts" cron="${everest.account.favoriteSearch.alerting.cronPattern}" /&gt;
      &lt;/task:scheduled-tasks&gt;
  </code></pre>
  
  <p>where, <code>everest.account.favoriteSearch.alerting.cronPattern=0 0 22 * * SUN</code></p>