title: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
body: <p>In my application I want to schedule mail using Spring Scheduler an below are my code.</p>
  
  <p>application-context.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:mvc="http://www.springframework.org/schema/mvc"
      xmlns:p="http://www.springframework.org/schema/p"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
          http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd"&gt;
  
      &lt;context:component-scan base-package="com.cnerge.dashboard"&gt;&lt;/context:component-scan&gt;
      &lt;mvc:annotation-driven/&gt;
      &lt;mvc:default-servlet-handler/&gt;
  
      &lt;mvc:resources mapping="/resources/**" location="/resources/" /&gt;
  
      &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;property name="prefix" value="/resources/views/" /&gt;
          &lt;property name="suffix" value=".html" /&gt; 
      &lt;/bean&gt;
  
      &lt;bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"&gt;
        &lt;property name="order" value="1" /&gt;
        &lt;property name="mediaTypes"&gt;
          &lt;map&gt;
             &lt;entry key="json" value="application/json" /&gt;
             &lt;entry key="xml" value="application/xml" /&gt;
             &lt;entry key="rss" value="application/rss+xml" /&gt;
          &lt;/map&gt;
        &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
      scope="singleton" lazy-init="false"&gt;
          &lt;property name="location" value="classpath:/LdapConfig.properties"/&gt;
      &lt;/bean&gt;
  
      &lt;bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt;
          &lt;property name="triggers"&gt;
              &lt;list&gt;
                  &lt;ref bean="scheduleMailCronTrigger"/&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="scheduleMailCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"&gt;
          &lt;property name="mailDetails" ref="scheduleMailJob"/&gt;
          &lt;property name="cronExpression" value="0/5 * * * * ?"&gt;&lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="scheduleMailJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean"&gt;
      &lt;property name="sendMailController" ref="sendMailController"/&gt;
          &lt;!-- &lt;property name="mailScheduleAsMap"&gt;
              &lt;map&gt;
                  &lt;entry Key="sendMailController" value-ref="sendMailController"&gt;&lt;/entry&gt;
              &lt;/map&gt;
          &lt;/property&gt; --&gt;
      &lt;/bean&gt;
  
      &lt;bean id="sendMailController" class="com.cnerge.dashboard.controller.SendMailController"&gt;
          &lt;property name="mailSender" ref="mailSender"&gt;&lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"&gt;
          &lt;property name="host" value="secure.emailsrvr.com" /&gt;
          &lt;property name="port" value="465"/&gt;
          &lt;property name="username" value="${mail.username}"/&gt;
          &lt;property name="password" value="${mail.password}"/&gt;
          &lt;property name="javaMailProperties"&gt;
              &lt;props&gt;
                  &lt;prop key="mail.transport.protocol"&gt;smtp&lt;/prop&gt;
                  &lt;prop key="mail.smtp.auth"&gt;true&lt;/prop&gt;
                  &lt;prop key="mail.smtp.starttls.enable"&gt;true&lt;/prop&gt;
                  &lt;prop key="mail.debug"&gt;true&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>SendMailController.java</p>
  
  <pre><code>package com.cnerge.dashboard.controller;
  
  import javax.ws.rs.Consumes;
  import javax.ws.rs.Produces;
  import javax.ws.rs.core.MediaType;
  
  import org.springframework.mail.SimpleMailMessage;
  import org.springframework.mail.javamail.JavaMailSender;
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestBody;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.ResponseBody;
  
  import com.cnerge.dashboard.pojo.EmailUser;
  
  @Controller
  public class SendMailController {
  
      private JavaMailSender mailSender;
  
      public JavaMailSender getMailSender() {
          return mailSender;
      }
  
      public void setMailSender(JavaMailSender mailSender) {
          this.mailSender = mailSender;
      }
  
      @RequestMapping(value="/sendMail", method = RequestMethod.POST)
      @Consumes(MediaType.APPLICATION_JSON)
      @Produces(MediaType.APPLICATION_JSON)
      public @ResponseBody void toSendMail(@RequestBody EmailUser emailUser){
  
          String recipient = emailUser.getRecipient();
          String cc = emailUser.getCc();
          String subject = emailUser.getSubject();
  
          System.out.println("To:" + recipient);
          System.out.println("cc:" + cc);
          System.out.println("subject" + subject);
  
          SimpleMailMessage mail = new SimpleMailMessage();
          mail.setTo(recipient);
          mail.setCc(cc);
          mail.setSubject(subject);
  
          mailSender.send(mail);
      }
  }
  </code></pre>
  
  <p>While starting tomcat server I am giving below error.</p>
  
  <pre><code>SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/quartz/impl/triggers/CronTriggerImpl
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1566)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
      at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5528)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:722)
  Caused by: java.lang.NoClassDefFoundError: org/quartz/impl/triggers/CronTriggerImpl
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
      at java.lang.Class.getDeclaredMethods(Class.java:1808)
      at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:571)
      at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:490)
      at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:474)
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:241)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1057)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1030)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getSingletonFactoryBeanForTypeCheck(AbstractAutowireCapableBeanFactory.java:860)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:790)
      at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:542)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:436)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:412)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:398)
      at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:1040)
      at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:142)
      at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:126)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:126)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1625)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1562)
      ... 22 more
  Caused by: java.lang.ClassNotFoundException: org.quartz.impl.triggers.CronTriggerImpl
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
      ... 43 more
  </code></pre>
  
  <p>I am not configuring RequestMapping in bean then to I am getting this error.</p>