The cron-expression element is invalid
Asked Answered
E

2

5

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?

Expect answered 10/7, 2012 at 14:50 Comment(0)
S
5

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.

Sech answered 10/7, 2012 at 14:55 Comment(0)
A
2

Just give

0 0 23 1/1 * ?

remove the * after question mark as quartz will take only 6 characters.

Amphitropous answered 3/9, 2014 at 23:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.