0 Replies Latest reply on Nov 26, 2010 6:57 AM by Andriy Lytvynskyy

    Configuring Quartz in External properties(EJBs are not injected)

    Andriy Lytvynskyy Newbie



      I'm using EJB 3.0, and I'm using Quartz, I removed all the annotations for my MDB which implements Job interface because I want to configure Quartz (cron scheduling) out of my application:

      I have quartz.properties which are in my classpath:


      # Configure Main Scheduler Properties


      org.quartz.scheduler.instanceName = QuartzScheduler
      org.quartz.scheduler.instanceId = AUTO


      # Configure ThreadPool

      org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
      org.quartz.threadPool.threadCount = 5
      org.quartz.threadPool.threadPriority = 5


      # Configure JobStore


      org.quartz.jobStore.misfireThreshold = 60000
      org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
      org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin
      org.quartz.plugin.jobInitializer.fileName = dpp-quartz-job.xml
      org.quartz.plugin.jobInitializer.overWriteExistingJobs = false
      org.quartz.plugin.jobInitializer.failOnFileNotFound = true


      I've got also dpp-quartz-job.xml which descibes my job and is placed to 'conf' folder in JBoss:

      <?xml version="1.0" encoding="UTF-8"?>

      <quartz xmlns="http://www.opensymphony.com/quartz/JobSchedulingData"
                  <job-data-map allows-transient-data="false">
                      <job-name>Task Parse</job-name>

                      <!-- Daily Every day at 18:15 PM -->

                      <cron-expression> 0 15 18 * * ?</cron-expression>


      Job starts correctly, but my class QuartzTask uses some @EJB annotations, and when my job starts those annotations do not inject EJB classes,  I receive only NULL values:

      public class QuartzTask implements Job {


          ManagerService manager; // is null


      If I use annotated configuration

      (@MessageDriven(activationConfig =
      {@ActivationConfigProperty(propertyName = "cronTrigger", propertyValue = "0 15 18 ? * *")}))  - everything works OK. What can be the reason of why those beans are not injected correctly when configuring Quartz via properties? Something with classloading?