[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Getting problem with TriggerListener  XML
Forum Index -> Quartz
Author Message
mayankr

journeyman

Joined: 04/14/2010 03:16:06
Messages: 21
Offline

I have created one job and scheduled it as following:

String myTriggerListener="reportMngrTriggerListener_"+ reportMngrId;
sched.addGlobalTriggerListener(new ReportManagerTriggerListener(myTriggerListener));
String jobListenerName="reportMngrFailedListener_" + reportMngrId;
sched.addGlobalJobListener(new ReportManagerFailedListener(jobListenerName));
JobDetail job = new JobDetail(model.getRpt_name()+"_"+reportMngrId, "ReportManagerScheduler", ReportManagerJob.class);
job.addJobListener(jobListenerName);
job.getJobDataMap().put("RPT_MNGR_VO", model);
job.setVolatility(false);

//Create trigger
CronTrigger trigger = new CronTrigger("CronTrigger-"+ model.getRpt_mngr_id(), "ReportManagerScheduler");

// Generate expression here. Set the start time & end time.
addExpression(trigger, model);

trigger.addTriggerListener(myTriggerListener);
trigger.setMisfireInstruction(CronTrigger.INSTRUCTION_RE_EXECUTE_JOB);
sched.scheduleJob(job, trigger);

I am working with Cron trigger on Web Application using Jboss server.
I am able to successfully configure Jobs and these jobs are executing on given time on regular intervals.
But as soon as i shutdown server and restart it the Quarts engine throws following error:

Error notifying listeners of trigger misfire.
org.quartz.SchedulerException: TriggerListener 'reportMngrTriggerListener_9' not found.
at org.quartz.core.QuartzScheduler.buildTriggerListenerList(QuartzScheduler.java:1404)
at org.quartz.core.QuartzScheduler.notifyTriggerListenersMisfired(QuartzScheduler.java:1461)
at org.quartz.core.SchedulerSignalerImpl.notifyTriggerListenersMisfired(SchedulerSignalerImpl.java:64)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.recoverMisfiredJobs(JobStoreSupport.java:759)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.recoverJobs(JobStoreSupport.java:671)
at org.quartz.impl.jdbcjobstore.JobStoreCMT.recoverJobs(JobStoreCMT.java:192)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize(JobStoreSupport.java:502)
at org.quartz.impl.jdbcjobstore.JobStoreCMT.initialize(JobStoreCMT.java:150)
at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:888)
at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1020)
at org.quartz.ee.servlet.QuartzInitializerServlet.init(QuartzInitializerServlet.java:125)

And due to this the QRTZ_TRIGGERS are getting in 'BLOCKED' state.
QrtzHelp

journeyman

Joined: 01/16/2010 09:44:00
Messages: 37
Offline


You have to re-register the Listener with the scheduler instance each time it is created (listeners themselves are not persisted - they are considered to be part of your application, and therefore your application's responsibility to manage their lifecycle).

The scheduler does remember/persist the name of the listener associated with the trigger. -- And hence you are running into the problem that after restarting the application the trigger fires and the scheduler knows to look for a listener with a particular name, but none has been registered with the newly instantiated scheduler.
QrtzHelp

journeyman

Joined: 01/16/2010 09:44:00
Messages: 37
Offline

Note that you can define listeners in the quartz.properties, and then Quartz will instantiate them on startup - but then are are limitations in that if they needed to be wired up by your application, they weren't.
mayankr

journeyman

Joined: 04/14/2010 03:16:06
Messages: 21
Offline

Thanks for the quick response
apaliwal

praetor

Joined: 01/05/2010 20:52:24
Messages: 223
Offline

Thanks !

cheers
ashish
Rummy

journeyman

Joined: 04/23/2010 02:57:29
Messages: 33
Offline

Hai,
Am also having the same issue. How to solve this. Please help me.


Thanks,
Ramya.

jhouse

seraphim
[Avatar]
Joined: 11/06/2009 15:29:56
Messages: 1703
Offline


The solution is given above.
 
Forum Index -> Quartz
Go to:   
Powered by JForum 2.1.7 © JForum Team