title: javax.servlet.ServletException: No adapter for handler
body: <p>I am learning spring and got stuck to one problem. I tried a lot and also google'd allot. I know that this question has been asked by many and they got there problem resolved , I treid them too but I am still getting the same error. Hence I am posting my files here please help me on this. I am trying too hard but getting no output.</p>
  
  <p>My Web.xml   looks like :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="2.5" 
  xmlns="http://java.sun.com/xml/ns/javaee" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
  http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
  &lt;welcome-file-list&gt;
    &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  
  &lt;servlet&gt;
  &lt;servlet-name&gt;spring&lt;/servlet-name&gt;
   &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
  &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
  &lt;servlet-name&gt;spring&lt;/servlet-name&gt;
  &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>and my spring-servlet.xml looks like:</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:mvc="http://www.springframework.org/schema/mvc"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
   http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
   http://www.springframework.org/schema/context          http://www.springframework.org/schema/context/spring-context.xsd"
  xmlns:context="http://www.springframew ork.org/schema/context"&gt;
  
     &lt;mvc:resources location="/images/" mapping="/images/**"/&gt;
     &lt;mvc:resources location="/jsp/js/" mapping="/jsp/js/**"/&gt;
     &lt;context:component-scan base-package="org.vinay.spring_mvc.mycontroller"&gt;&lt;/context:component-scan&gt;
     &lt;context:annotation-config/&gt;
      &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
      &lt;property name="viewClass"  value="org.springframework.web.servlet.view.JstlView" /&gt;
      &lt;property name="prefix" value="/jsp/" /&gt;
      &lt;property name="suffix" value=".jsp" /&gt;
      &lt;/bean&gt;
      &lt;bean id="handlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"&gt;
      &lt;property name="mappings"&gt;
      &lt;props&gt;
      &lt;prop key="/employee"&gt;myController&lt;/prop&gt;
      &lt;/props&gt;
      &lt;/property&gt;
       &lt;/bean&gt;
      &lt;bean id="myController" class="org.vinay.spring_mvc.mycontroller.MyController"&gt;&lt;/bean&gt;
      &lt;bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"&gt;&lt;/bean&gt;
      &lt;/beans&gt;
  </code></pre>
  
  <p>and my controller looks like:</p>
  
  <pre><code>package org.vinay.spring_mvc.mycontroller;
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.servlet.ModelAndView;
  
  
  
  @Controller
  @RequestMapping(value = "/employee", method = RequestMethod.GET)
  public class MyController {
  
  
  public ModelAndView helloWorld()
  {
      System.out.println("Hello World");
      return new ModelAndView("/hello");
      //return new ModelAndView("helloWorld.jsp");
  }
  }
  </code></pre>
  
  <p>and the JSP from which Iam sending request is a welcome file of web.xml. i.e. index.jsp . it looks like:</p>
  
  <pre><code>&lt;%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%&gt;
  &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
  &lt;%
  String path = request.getContextPath();
  String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()path+"/";
  %&gt;
    &lt;%System.err.print("Path : "+request.getContextPath()); %&gt;
  
   &lt;html&gt;
  &lt;head&gt;
   &lt;title&gt;Solution Center&lt;/title&gt;
      &lt;h5&gt;Welcome To Solution Center&lt;/h5&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;a href="employee"&gt;hello&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Can anyone please help me why i am getting the below errors:</p>
  
  <pre><code>javax.servlet.ServletException: No adapter for handler   [org.vinay.spring_mvc.mycontroller.MyController@18c8aea]: The DispatcherServlet configuration needs  to include a HandlerAdapter that supports this handler
      org.springframework.web.servlet.DispatcherServlet.getHandlerAdapter    (DispatcherServlet.java:1128)
  org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:903)
  org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
  org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920)
  org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:816)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
  org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  </code></pre>
  
  <p>I tried using annotation based handler adapter also but got the same error. any help on this will be helpful.</p>
  
  <p>I only figured out that I am getting this due to inclusion of mvc:resources tags. I f I Comment them my project works fine.  Any help on them would be very helpful . I already have tried lot of other ways please provide me step by step solution. I am not able to solve this problem from last 4 hours.</p>