The cron-expression element is invalid

Jonas Stawski picture Jonas Stawski · Jul 10, 2012 · Viewed 7.8k times · Source

I'm trying to use quartz_jobs.xml to schedule all my jobs, but the following XML results in an error:

The cron-expression element is invalid. The value '0 0 23 1/1 * ? *' is invalid according to its datatype.

Here's the XML:

<?xml version="1.0" encoding="utf-8" ?>
<job-scheduling-data xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd"
  version="1.8">
  <schedule>
    <job>
      <name>AUI</name>
      <group>Group1</group>

      <description>Archive Unpublished Incidents</description>
      <job-class>ArchiveUnpublishedIncidents</job-class>
    </job>
    <trigger>
      <cron>
        <name>AUITrigger</name>
        <group>TriggerGroup1</group>
        <job-name>AUI</job-name>

        <job-group>Group1</job-group>
        <!-- trigger every night at 11 pm -->
        <cron-expression>0 0 23 1/1 * ? *</cron-expression>
      </cron>
    </trigger>
  </schedule>
</job-scheduling-data>

What is wrong with that cron expression?

Answer

Brian Agnew picture Brian Agnew · Jul 10, 2012

This document suggest that if you're specifying 7 elements, the last needs to be a year or year range. The year field is marked as optional, and consequently doesn't seem to be specifiable as a wildcard.