title: @Pathvariable Map<String,String> is giving me HTTP Status 500 -
body: <p>I have written a request handler method in a controller class in Spring MVC. When I'm calling the <code>http://localhost:8080/ProjectName/hello/santhosh/india</code> URL, I got a HTTP Status 500 - exception.</p>
  
  <p>This is the method:</p>
  
  <pre><code>@RequestMapping("/hello/{userName}/{country}")
  public ModelAndView sayHello(@PathVariable Map&lt;String, String&gt; pathVar){
      String name = pathVar.get("userName");
      String country = pathVar.get("country");
      System.out.println("Hello!!" + name + " from " + country);
  
      ModelAndView model = new ModelAndView("login");
      model.addObject("msg","Hello!!" + name);
      return model;
  }
  </code></pre>
  
  <p>This is the exception:</p>
  
  <blockquote>
    <p>HTTP Status 500 - </p>
    
    <p>type Exception report</p>
    
    <p>message</p>
    
    <p>description The server encountered an internal error () that prevented
    it from fulfilling this request.</p>
    
    <p>exception</p>
    
    <p>org.springframework.web.util.NestedServletException: Request
    processing failed; nested exception is
    org.springframework.web.bind.annotation.support.HandlerMethodInvocationException:
    Failed to invoke handler method [public
    org.springframework.web.servlet.ModelAndView
    com.techmahindra.controller.LoginController.sayHello(java.util.Map)];
    nested exception is java.lang.IllegalStateException: Could not find
    @PathVariable [pathVar] in @RequestMapping
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)</p>
    
    <p>root cause</p>
    
    <p>org.springframework.web.bind.annotation.support.HandlerMethodInvocationException:
    Failed to invoke handler method [public
    org.springframework.web.servlet.ModelAndView
    com.techmahindra.controller.LoginController.sayHello(java.util.Map)];
    nested exception is java.lang.IllegalStateException: Could not find
    @PathVariable [pathVar] in @RequestMapping
      org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:185)
      org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:440)
      org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:428)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)</p>
    
    <p>root cause</p>
    
    <p><strong>java.lang.IllegalStateException: Could not find @PathVariable</strong>
    <strong>[pathVar] in @RequestMapping</strong>
      org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.resolvePathVariable(AnnotationMethodHandlerAdapter.java:856)
      org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolvePathVariable(HandlerMethodInvoker.java:718)
      org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:367)
      org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:175)
      org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:440)
      org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:428)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)</p>
  </blockquote>