title: Getting this org.springframework.web.servlet.DispatcherServlet noHandlerFound error and WARNING: No mapping found for HTTP request URI in Spring MVC
body: <p><a href="https://i.stack.imgur.com/glKPc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/glKPc.png" alt="enter image description here"></a> 
  <strong>Index.jsp</strong></p>
  
  <pre><code>&lt;html&gt;
      &lt;body&gt;
          &lt;form action="add"&gt;
              &lt;input type="text" name="t1"&gt;&lt;br&gt;
              &lt;input type="text" name="t2"&gt;&lt;br&gt;
              &lt;input type="submit" /&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Web.xml</strong></p>
  
  <pre><code>&lt;!DOCTYPE web-app PUBLIC
      "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
      "http://java.sun.com/dtd/web-app_2_3.dtd" &gt;
  &lt;web-app&gt;
      &lt;display-name&gt;Archetype Created Web Application&lt;/display-name&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;telusko&lt;/servlet-name&gt;
          &lt;servlet-class&gt;
              org.springframework.web.servlet.DispatcherServlet
          &lt;/servlet-class&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;telusko&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p><strong>telusko-servlet.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans
      xmlns="http://www.springframework.org/schema/beans"
      xmlns:ctx="http://www.springframework.org/schema/context"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:mvc="http://www.springframework.org/schema/mvc"
      xsi:schemaLocation="http://www.springframework.org/schema/beans 
      http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
      http://www.springframework.org/schema/mvc
      http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context-2.5.xsd "&gt;
      &lt;!-- &lt;mvc:default-servlet-handler/&gt;  --&gt;
      &lt;mvc:annotation-driven/&gt;
      &lt;ctx:annotation-config&gt;&lt;/ctx:annotation-config&gt;
      &lt;ctx:component-scan base-package="resources.com.telusko"&gt;&lt;/ctx:component-scan&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>AddController.java</strong></p>
  
  <pre><code>package com.telusko;
  
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  
  @Controller
  public class AddController {
      @RequestMapping("/add")
      public void add() {
          System.out.println("i am here");
      }
  }
  </code></pre>
  
  <p><strong>I have an index.jsp file where I declare action=/add. Now in web.xml in declare a dispatcher in which given servlet name login. After that make a telusko-servlet.xml where define base-package:</strong></p>
  
  <pre><code>&lt;ctx:component-scan base-package="com.telusko"&gt;&lt;/ctx:component-scan&gt;
  </code></pre>
  
  <p><strong>After that make a class of logincontroller and use annotaion <code>@Controller</code> above class and <code>@RequestMapping("/add)</code> above method of logincontroller class. And after that running the index.jsp file still giving me error why <code>noHandlerFound</code> error occurs as in login-servlet.xml. I have given base-package name com.telusko where AddController.java file is there.</strong></p>
  
  <blockquote>
    <p>I should get <strong>"i am here"</strong> message on console but not getting it instead of that getting <strong>WARNING: No mapping found for HTTP request</strong></p>
  </blockquote>
  
  <pre><code>Sep 26, 2018 10:47:36 PM org.springframework.web.servlet.DispatcherServlet 
  initServletBean
  INFO: FrameworkServlet 'telusko': initialization started
  Sep 26, 2018 10:47:36 PM 
  org.springframework.web.context.support.XmlWebApplicationContext 
  prepareRefresh
  INFO: Refreshing WebApplicationContext for namespace 'telusko-servlet': 
  startup date [Wed Sep 26 22:47:36 IST 2018]; root of context hierarchy
  Sep 26, 2018 10:47:36 PM 
  org.springframework.beans.factory.xml.XmlBeanDefinitionReader 
  loadBeanDefinitions
  INFO: Loading XML bean definitions from ServletContext resource [/WEB- 
  INF/telusko-servlet.xml]
  Sep 26, 2018 10:47:38 PM org.springframework.web.servlet.DispatcherServlet 
  initServletBean
  INFO: FrameworkServlet 'telusko': initialization completed in 2096 ms
  Sep 26, 2018 10:47:38 PM org.apache.catalina.core.StandardWrapperValve 
  invoke
  SEVERE: Servlet.service() for servlet [telusko] in context with path 
  [/DemoMVC] threw exception [Servlet execution threw an exception] with root 
  cause
  java.lang.NoSuchMethodError:   
  org.springframework.http.HttpMethod.resolve(Ljava/lang/String;)
  Lorg/springframe 
  ork/http/HttpMethod;
  at 
  
  org.springframework.web.servlet.FrameworkServlet.service
  (FrameworkServlet.java:8 
  41)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
  at 
  
  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
   (ApplicationFilterChain.java:231)
   at 
  
  
   org.apache.catalina.core.ApplicationFilterChain.doFilter
   (ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
   at 
  
   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
  (ApplicationFilterChain.java:193)
  at 
  
  org.apache.catalina.core.ApplicationFilterChain.doFilter
  (ApplicationFilterChain.java:166 at 
  org.apache.catalina.core.StandardWrapperValve.invoke
  (StandardWrapperValve.java:199)at 
  
  org.apache.catalina.core.StandardContextValve.invoke
   (StandardContextValve.java:96)at 
  
  org.apache.catalina.authenticator.AuthenticatorBase.invoke
  (AuthenticatorBase.jav 
  a:490)
  at 
  org.apache.catalina.core.StandardHostValve.invoke
  (StandardHostValve.java:139)
      at 
  org.apache.catalina.valves.ErrorReportValve.invoke
  (ErrorReportValve.java:92)
  at 
  
  org.apache.catalina.valves.AbstractAccessLogValve.invoke
  (AbstractAccessLogValve. 
  java:668)
  at 
  
  org.apache.catalina.core.StandardEngineValve.invoke
  (StandardEngineValve.java:74)
  at 
  org.apache.catalina.connector.CoyoteAdapter.service
  (CoyoteAdapter.java:343)
  at 
  org.apache.coyote.http11.Http11Processor.service
  (Http11Processor.java:408)at 
  
  org.apache.coyote.AbstractProcessorLight.process
   (AbstractProcessorLight.java:66)at 
  
  org.apache.coyote.AbstractProtocol$ConnectionHandler.process
  (AbstractProtocol.ja 
  va:770)at 
  
  org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun
  (NioEndpoint.java:1415)at 
  
  org.apache.tomcat.util.net.SocketProcessorBase.run
  (SocketProcessorBase.java:49)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at 
  
  
  
  org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run
  (TaskThread.java:61)
  at java.lang.Thread.run(Unknown Source)
  </code></pre>