title: Getting exception org.quartz.SchedulerException: Registration of jobs and triggers failed: Found interface org.quartz.Trigger, but class was expected
body: <p>I am getting the exception </p>
  
  <p>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler' defined in class path resource</p>
  
  <p>can anyone please help me to resolve the issue..</p>
  
  <p>I am using following dependency</p>
  
  <pre><code>            &lt;dependency&gt;
                  &lt;groupId&gt;org.quartz-scheduler&lt;/groupId&gt;
                  &lt;artifactId&gt;quartz&lt;/artifactId&gt;
                  &lt;version&gt;2.2.1&lt;/version&gt;
              &lt;/dependency&gt;
  
              `enter code here`&lt;dependency&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-context-support&lt;/artifactId&gt;
                  &lt;version&gt;4.0.0.RELEASE&lt;/version&gt;
              &lt;/dependency&gt;
  </code></pre>
  
  <p>My code is below</p>
  
  <pre><code>    @Configuration
      @ComponentScan(
              basePackages = {"com.test"},
              useDefaultFilters = false,
              includeFilters = {
                  @ComponentScan.Filter(type = FilterType.ANNOTATION, value = Service.class),
                  @ComponentScan.Filter(type = FilterType.ANNOTATION, value = Component.class)
              })
      public class QuartzConfig {
  
          // this data source points to the database that contains Quartz tables
          @Autowired
          private DataSource dataSource;
  
          @Autowired
          private PlatformTransactionManager transactionManager;
  
          @Autowired
          private ApplicationContext applicationContext;
  
          @Bean
          public SchedulerFactoryBean quartzScheduler() {
  
              SchedulerFactoryBean quartzScheduler = new SchedulerFactoryBean();
  
              quartzScheduler.setQuartzProperties(quartzProperties());
              quartzScheduler.setDataSource(dataSource);
              quartzScheduler.setTransactionManager(transactionManager);
              quartzScheduler.setOverwriteExistingJobs(true);
  
              // Custom job factory of spring with DI support for @Autowired
              AutowiringSpringBeanJobFactory jobFactory = new AutowiringSpringBeanJobFactory();
              jobFactory.setApplicationContext(applicationContext);
              quartzScheduler.setJobFactory(jobFactory);
  
              Trigger[] triggers = {
                  processMyJobTrigger().getObject()
              };
  
              quartzScheduler.setTriggers(triggers);
  
              JobDetail[] jobDetails = {
                  processMyJob().getObject()
              };
  
              quartzScheduler.setJobDetails(jobDetails);
  
              System.out.println("Here 111212121212");
  
              return quartzScheduler;
          }
  
          @Bean
          public JobDetailFactoryBean processMyJob() {
              JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
              jobDetailFactory.setJobClass(MyJob.class);
              jobDetailFactory.setDurability(true);
              return jobDetailFactory;
          }
  
          @Bean
          public CronTriggerFactoryBean processMyJobTrigger() {
              CronTriggerFactoryBean cronTriggerFactoryBean = new CronTriggerFactoryBean();
              cronTriggerFactoryBean.setJobDetail(processMyJob().getObject());
              cronTriggerFactoryBean.setCronExpression("0 0/1 * * * ?");
              return cronTriggerFactoryBean;
          }
  
          @Bean
          public Properties quartzProperties() {
              PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
              propertiesFactoryBean.setLocation(new ClassPathResource("quartz.properties"));
              Properties properties;
  
              try {
                  propertiesFactoryBean.afterPropertiesSet();
                  properties = propertiesFactoryBean.getObject();
              } catch (IOException e) {
                  throw new RuntimeException("Unable to load quartz.properties", e);
              }
  
              return properties;
          }
      }
  </code></pre>