title: Cannot find class [org.springframework.scheduling.quartz.SchedulerFactoryBean] in Spring web app
body: <p>I'm trying to build a scheduler inside my web application in Spring. I use maven to deal with all the dependencies. I have put the following bean in my XML</p>
  
  <pre><code>&lt;bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt;
      &lt;property name="configLocation" value="classpath:quartz.properties" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>In the web.xml file I have the following (from a tutorial):</p>
  
  <pre><code>&lt;context-param&gt;
       &lt;param-name&gt;quartz:config-file&lt;/param-name&gt;
       &lt;param-value&gt;quartz.properties&lt;/param-value&gt;
   &lt;/context-param&gt;
   &lt;context-param&gt;
       &lt;param-name&gt;quartz:shutdown-on-unload&lt;/param-name&gt;
       &lt;param-value&gt;true&lt;/param-value&gt;
   &lt;/context-param&gt;
   &lt;context-param&gt;
       &lt;param-name&gt;quartz:wait-on-shutdown&lt;/param-name&gt;
       &lt;param-value&gt;false&lt;/param-value&gt;
   &lt;/context-param&gt;
   &lt;context-param&gt;
       &lt;param-name&gt;quartz:start-scheduler-on-load&lt;/param-name&gt;
       &lt;param-value&gt;true&lt;/param-value&gt;
   &lt;/context-param&gt;
  </code></pre>
  
  <p>While in my pom.xml I added again what a tutorial suggested</p>
  
  <pre><code>    &lt;!-- Quartz API --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;opensymphony&lt;/groupId&gt;
          &lt;artifactId&gt;quartz&lt;/artifactId&gt;
          &lt;version&gt;1.6.3&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;commons-collections&lt;/groupId&gt;
          &lt;artifactId&gt;commons-collections&lt;/artifactId&gt;
          &lt;version&gt;3.2.1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.directory.studio&lt;/groupId&gt;
          &lt;artifactId&gt;org.apache.commons.logging&lt;/artifactId&gt;
          &lt;version&gt;1.1.1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &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;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.quartz-scheduler&lt;/groupId&gt;
          &lt;artifactId&gt;quartz-jobs&lt;/artifactId&gt;
          &lt;version&gt;2.2.0&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>I also defined a quartz.properties file</p>
  
  <pre><code>org.quartz.plugin.jobInitializer.class = 
  org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin
  org.quartz.plugin.jobInitializer.fileNames = quartz_jobs.xml
  org.quartz.plugin.jobInitializer.failOnFileNotFound = true
  org.quartz.plugin.jobInitializer.scanInterval = 10
  org.quartz.plugin.jobInitializer.wrapInUserTransaction = false
  org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool 
  </code></pre>
  
  <p>And of course my quartz_jobs.xml file:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;job-scheduling-data xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.quartz- 
  scheduler.org/xml/JobSchedulingData http://www.quartz- 
  scheduler.org/xml/job_scheduling_data_1_8.xsd"
    version="1.8"&gt;
  
  &lt;schedule&gt;
      &lt;job&gt;
          &lt;name&gt;myJob&lt;/name&gt;
          &lt;group&gt;MYJOB_GROUP&lt;/group&gt;
  
          &lt;description&gt;My job description&lt;/description&gt;
          &lt;job-class&gt;com.blah.blah.myJob&lt;/job-class&gt;
  
      &lt;/job&gt;
  
      &lt;trigger&gt;
          &lt;cron&gt;
              &lt;name&gt;myTrigger&lt;/name&gt;
              &lt;group&gt;MYTRIGGER_GROUP&lt;/group&gt;
              &lt;job-name&gt;myJob&lt;/job-name&gt;
  
              &lt;job-group&gt;MYJOB_GROUP&lt;/job-group&gt;
              &lt;!-- trigger every 5 seconds --&gt;
              &lt;cron-expression&gt;0/5 * * * * ?&lt;/cron-expression&gt;
  
          &lt;/cron&gt;
      &lt;/trigger&gt;
  &lt;/schedule&gt;
  </code></pre>
  
  <p></p>
  
  <p>I then created a scheduler and a job class (basic tutorial-like classes). My issue is that when I run it I receive 3 errors:</p>
  
  <pre><code>2018-09-10 14:52:23,636 - ERROR - [org.springframework.web.context.ContextLoader] - Context initialization failed
  org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.scheduling.quartz.SchedulerFactoryBean] for bean with name 'org.springframework.scheduling.quartz.SchedulerFactoryBean#0' defined in class path resource ...
  
  Sep 10, 2018 2:52:23 PM org.apache.catalina.core.StandardContext listenerStart
  SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
  org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.scheduling.quartz.SchedulerFactoryBean] for bean with name 
  'org.springframework.scheduling.quartz.SchedulerFactoryBean#0' defined in class path resource ...
  
  Quartz Initializer Servlet loaded, initializing Scheduler...
  Sep 10, 2018 2:52:23 PM org.apache.catalina.core.StandardContext listenerStart
  SEVERE: Exception sending context initialized event to listener instance of class org.quartz.ee.servlet.QuartzInitializerListener
  java.lang.NoClassDefFoundError: javax/transaction/UserTransaction
  </code></pre>
  
  <p>After some more logging it says <code>Quartz Scheduler successful shutdown.</code>. I have NO idea of what is going on, I am not super confident of what I did because I don't really know Java spring and its configuration. Can anybody figure out what am I missing?</p>
  
  <p>EDIT: the third error was solved by adding <code>javax.transaction</code> in my pom.xml</p>
  
  <p>EDIT2: here is the complete stack trace:</p>
  
  <pre><code>2018-09-10 16:28:10,698 - ERROR - [org.springframework.web.context.ContextLoader] - Context initialization failed
  org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.scheduling.quartz.SchedulerFactoryBean] for bean with name 'org.springframework.scheduling.quartz.SchedulerFactoryBean#0' defined in class path resource [ctx-core/my.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.scheduling.quartz.SchedulerFactoryBean
          at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1278)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:575)
          at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1347)
          at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:913)
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:617)
          at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
          at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
          at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
          at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
          at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5017)
          at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5531)
          at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
          at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
          at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
  Caused by: java.lang.ClassNotFoundException: org.springframework.scheduling.quartz.SchedulerFactoryBean
          at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1722)
          at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1573)
          at org.springframework.util.ClassUtils.forName(ClassUtils.java:265)
          at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:419)
          at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1299)
          at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1270)
          ... 18 more
  Sep 10, 2018 4:28:10 PM org.apache.catalina.core.StandardContext listenerStart
  SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
  org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.scheduling.quartz.SchedulerFactoryBean] for bean with name 'org.springframework.scheduling.quartz.SchedulerFactoryBean#0' defined in class path resource [ctx-core/my.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.scheduling.quartz.SchedulerFactoryBean
          at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1278)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:575)
          at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1347)
          at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:913)
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:617)
          at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
          at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
          at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
          at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
          at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5017)
          at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5531)
          at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
          at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
          at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
  Caused by: java.lang.ClassNotFoundException: org.springframework.scheduling.quartz.SchedulerFactoryBean
          at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1722)
          at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1573)
          at org.springframework.util.ClassUtils.forName(ClassUtils.java:265)
          at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:419)
          at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1299)
          at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1270)
          ... 18 more
  Quartz Initializer Servlet loaded, initializing Scheduler...
  2018-09-10 16:28:10,730 - INFO  - [org.quartz.core.SchedulerSignalerImpl] - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
  2018-09-10 16:28:10,730 - INFO  - [org.quartz.core.QuartzScheduler] - Quartz Scheduler v.1.6.3 created.
  2018-09-10 16:28:10,730 - INFO  - [org.quartz.simpl.RAMJobStore] - RAMJobStore initialized.
  2018-09-10 16:28:10,730 - INFO  - [org.quartz.impl.StdSchedulerFactory] - Quartz scheduler 'QuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
  2018-09-10 16:28:10,730 - INFO  - [org.quartz.impl.StdSchedulerFactory] - Quartz scheduler version: 1.6.3
  2018-09-10 16:28:10,730 - INFO  - [org.quartz.core.QuartzScheduler] - Scheduler QuartzScheduler_$_NON_CLUSTERED started.
  Scheduler has been started...
  Storing the Quartz Scheduler Factory in the servlet context at key: org.quartz.impl.StdSchedulerFactory.KEY
  Sep 10, 2018 4:28:10 PM org.apache.catalina.core.StandardContext startInternal
  SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
  Sep 10, 2018 4:28:10 PM org.apache.catalina.core.StandardContext startInternal
  SEVERE: Context [/myproject] startup failed due to previous errors
  2018-09-10 16:28:10,734 - INFO  - [org.quartz.core.QuartzScheduler] - Scheduler QuartzScheduler_$_NON_CLUSTERED shutting down.
  2018-09-10 16:28:10,734 - INFO  - [org.quartz.core.QuartzScheduler] - Scheduler QuartzScheduler_$_NON_CLUSTERED paused.
  2018-09-10 16:28:10,734 - INFO  - [org.quartz.core.QuartzScheduler] - Scheduler QuartzScheduler_$_NON_CLUSTERED shutdown complete.
  Quartz Scheduler successful shutdown.
  </code></pre>