2

なぜこの Quartz cron 式が機能しないのか疑問に思っています:

<trigger>
         <cron>
            <name>jobtriggername</name>
            <group>groupname</group>
            <job-name>jobname</job-name>
            <job-group>jobgroup</job-group>
            <misfire-instruction>MISFIRE_INSTRUCTION_DO_NOTHING</misfire-instruction>
            <cron-expression>0 0/30 0-6,12,19-23 * * ?</cron-expression>
          </cron>
      </trigger>

アプリケーション サーバーを起動すると、次の例外がスローされます。

ERROR [org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin] (MSC service thread 1-8 ) [] Error scheduling jobs: Encountered 2 validation exceptions.: org.quartz.xml.Vali
dationException: Encountered 2 validation exceptions.
        at org.quartz.xml.XMLSchedulingDataProcessor.maybeThrowValidationException(XMLSchedulingDataProcessor.java:1256)
        at org.quartz.xml.XMLSchedulingDataProcessor.processFile(XMLSchedulingDataProcessor.java:505)
        at org.quartz.xml.XMLSchedulingDataProcessor.processFileAndScheduleJobs(XMLSchedulingDataProcessor.java:886)
        at org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin.processFile(XMLSchedulingDataProcessorPlugin.java:330)
        at org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin.start(XMLSchedulingDataProcessorPlugin.java:257)
        at org.quartz.plugins.SchedulerPluginWithUserTransactionSupport.start(SchedulerPluginWithUserTransactionSupport.java:144)
        at org.quartz.core.QuartzScheduler.startPlugins(QuartzScheduler.java:2343)
        at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:527)
        at org.quartz.impl.StdScheduler.start(StdScheduler.java:143)
        at org.quartz.ee.servlet.QuartzInitializerServlet.init(QuartzInitializerServlet.java:211)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873)
        at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
        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: org.xml.sax.SAXParseException: cvc-pattern-valid: Value '0 0/30 0-6,12,19-23 * * ?' is not facet-valid with respect to pattern '(((([0-9]|[0-5][0-9]),)*([0-9]|[0-5][0-9]))|(([\*]|[0-9]|[0-5][0
-9])(/|-)([0-9]|[0-5][0-9]))|([\?])|([\*]))[\s](((([0-9]|[0-5][0-9]),)*([0-9]|[0-5][0-9]))|(([\*]|[0-9]|[0-5][0-9])(/|-)([0-9]|[0-5][0-9]))|([\?])|([\*]))[\s](((([0-9]|[0-1][0-9]|[2][0-3]),)*([0-9]
|[0-1][0-9]|[2][0-3]))|(([\*]|[0-9]|[0-1][0-9]|[2][0-3])(/|-)([0-9]|[0-1][0-9]|[2][0-3]))|([\?])|([\*]))[\s](((([1-9]|[0][1-9]|[1-2][0-9]|[3][0-1]),)*([1-9]|[0][1-9]|[1-2][0-9]|[3][0-1])(C)?)|(([1-
9]|[0][1-9]|[1-2][0-9]|[3][0-1])(/|-)([1-9]|[0][1-9]|[1-2][0-9]|[3][0-1])(C)?)|(L(-[0-9])?)|(L(-[1-2][0-9])?)|(L(-[3][0-1])?)|(LW)|([1-9]W)|([1-3][0-9]W)|([\?])|([\*]))[\s](((([1-9]|0[1-9]|1[0-2]),
)*([1-9]|0[1-9]|1[0-2]))|(([1-9]|0[1-9]|1[0-2])(/|-)([1-9]|0[1-9]|1[0-2]))|(((JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC),)*(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))|((JAN|FEB|MAR|APR
|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(-|/)(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))|([\?])|([\*]))[\s]((([1-7],)*([1-7]))|([1-7](/|-)([1-7]))|(((MON|TUE|WED|THU|FRI|SAT|SUN),)*(MON|TUE|WED|THU
|FRI|SAT|SUN)(C)?)|((MON|TUE|WED|THU|FRI|SAT|SUN)(-|/)(MON|TUE|WED|THU|FRI|SAT|SUN)(C)?)|(([1-7]|(MON|TUE|WED|THU|FRI|SAT|SUN))?(L|LW)?)|(([1-7]|MON|TUE|WED|THU|FRI|SAT|SUN)#([1-7])?)|([\?])|([\*])
)([\s]?(([\*])?|(19[7-9][0-9])|(20[0-9][0-9]))?| (((19[7-9][0-9])|(20[0-9][0-9]))(-|/)((19[7-9][0-9])|(20[0-9][0-9])))?| ((((19[7-9][0-9])|(20[0-9][0-9])),)*((19[7-9][0-9])|(20[0-9][0-9])))?)' for
type 'cron-expressionType'.
        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
        at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)

これは難解な cron 式ではないと思いますか?

4

1 に答える 1

0

ここでいくつかの例を見てください。

0 0/30 0-6,12,19-23 * * ?

ここ0-6,12,19-23のセクションが問題のようです。で置き換えてみてください

0,1,2,3,4,5,6,12,19,20,21,22,23

他の一部のベンダーは のような複雑な cron 式をサポート0 0/5 14,18,3-39,52 ? JAN,MAR,SEP MON-FRI 2002-2010していますが、Quartz はサポートしていないと思います。これが機能しない場合は、cron 要件を教えてください。

于 2014-08-21T10:09:07.997 に答える