Fire Job quartz doesn't work right away

I have integrated quartz 2 and spring 4 with maven and java annotation (using servlet 3), also I am using tomcat 7 maven plugin to deploy my project, my quartz config class is as below:

enter image description here

and my job class will define simply as below:

enter image description here

then I am using quartz scheduler to automatically start my startup run immediately like below:

enter image description here

but my problem is: when i call the fireNow method with parameters "job1", "mygroup" nothing happens and my job1 does not call immediately and print nothing to the console, I also keep track of the db tables and I noticed after running the fireNow method a new one row inserted into my qrtz_triggers table in mysql:

enter image description here

+2


source to share


2 answers


If the Quartz scheduler is not configured to start automatically. You need to run it explicitly.

scheduler.start();

      



If the Quartz scheduler started successfully, you should see information in your log or console as shown below.

[main] INFO org.quartz.core.QuartzScheduler - Scheduler metadata: Quartz Scheduler (v2.2.1)
'org.springframework.scheduling.quartz.SchedulerFactoryBean # 0' with instanceId 'MyScheduler'
Scheduler class: 'org.quartz.core .QuartzScheduler '- executed locally.
NOT THE BEGINNING.
In standby.
Number of jobs done: 0

Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job store "org.quartz.simpl.RAMJobStore" - which does not maintain persistence. and is not clustered.
...
[home] INFO org.quartz.core.QuartzScheduler - launched

+1


source


Finally I found a solution for my problem after enabling quartz log4j (adding log4j.logger.org.quartz = DEBUG to my log4j.properties), I saw the jdbc exception in the console, the exception is due to using a legacy quartz query.



I added quartz 2.2.1 dependency in my POM, but I was using Quartz sql query for version 2.1.7 and that the mismatch between quartz jar and quartz sql version causes some table to be missing like SCHED_TIME.

0


source







All Articles