DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Thomas has posted 33 posts at DZone. View Full User Profile

Listening For Exception Thrown During The Execution Of A Quartz Job In Spring

  • submit to reddit
        Code of the exception listener : 
package some.package;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.listeners.JobListenerSupport;

public class JobExecutionExceptionListener extends JobListenerSupport {
  public String getName() {
    return "JobExecutionExceptionListener";

  public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) {
    if (jobException != null) {
      // handle exception 

Spring configuration :

	<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
		<!-- other properties -->
		<property name="globalJobListeners">
		    <bean class="some.package.JobExecutionExceptionListener"/>