Search code examples
javaxmlquartz-scheduler

Quartz Scheduler, XML ValidationException


I'm trying to setup a Quartz Scheduler job using an XML file, the scheduler object is reading the .properties file and finds the XML job definition file. however I am getting a parsing validation exception and I can't seem to be able to find what's wrong based on the error

11:14:12.314 [localhost-startStop-1] ERROR o.q.p.x.XMLSchedulingDataProcessorPlugin - Error scheduling jobs: Encountered 2 validation exceptions.

org.quartz.xml.ValidationException: Encountered 2 validation exceptions.

and then

Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'group'. One of '{"http://www.quartz-scheduler.org/xml/JobSchedulingData":durability, "http://www.quartz-scheduler.org/xml/JobSchedulingData":job-data-map}' is expected.

I have already defined <durability> and the job doesn't require a data map.

My XML is

<?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>MailJob</name>
            <description>Mail dispatcher job</description>
            <job-class>com.myapplication.reporting.MailJob</job-class>
            <group>MailGroup</group>
            <durability>false</durability>
        </job>

        <trigger>
            <simple>
                <name>MailTrigger</name>
                <description>Mail dispatcher job trigger, this should be set to run every 1 minute</description>
                <repeat-interval>60000</repeat-interval>
                <group>MailTriggerGroup</group>
                <job-name>MailJob</job-name>
                <job-group>mailGroup</job-group>
            </simple>
        </trigger>
    </schedule>
</job-scheduling-data>

I am using Quartz 2.2.2


Solution

  • I suppose the problem may be in the order in which you define nodes in your XML.

    Try reorder them like here

    I.e. name/group/description then other settings.