java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path '/my/extend/post/': {public java.lang.String nlproject.controller.MyExtendController.extendPost(nl.project.VO.MyVO,org.springframework.validation.BindingResult,org.springframework.ui.ModelMap,org.springframework.web.context.request.NativeWebRequest) throws java.lang.Exception, public java.lang.String nl.project.controller.MyController.post(nl.project.VO.MyVO,org.springframework.validation.BindingResult,org.springframework.ui.ModelMap,org.springframework.web.context.request.NativeWebRequest)}. If you intend to handle the same path in multiple methods, then factor them out into a dedicated handler class with that path mapped at the type level!

Spring JIRA | marc schipperheyn | 5 years ago
  1. 0

    {code} @Controller @RequestMapping("/my") public class MyController extends ExtendedController @RequestMapping(method = RequestMethod.POST, value = "/post/") public String post( @ModelAttribute("vo") MyVO vo, BindingResult result, ModelMap model, NativeWebRequest request) throws Exception{ [...] @Controller @RequestMapping("/my/extend") public class MyController extends ExtendedController @RequestMapping(method = RequestMethod.POST, value = "/post/") public String extendPost( @ModelAttribute("vo") MyVO vo, BindingResult result, ModelMap model, NativeWebRequest request) throws Exception{ {code} This leads to {code} java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path '/my/extend/post/': {public java.lang.String nlproject.controller.MyExtendController.extendPost(nl.project.VO.MyVO,org.springframework.validation.BindingResult,org.springframework.ui.ModelMap,org.springframework.web.context.request.NativeWebRequest) throws java.lang.Exception, public java.lang.String nl.project.controller.MyController.post(nl.project.VO.MyVO,org.springframework.validation.BindingResult,org.springframework.ui.ModelMap,org.springframework.web.context.request.NativeWebRequest)}. If you intend to handle the same path in multiple methods, then factor them out into a dedicated handler class with that path mapped at the type level! at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodResolver.resolveHandlerMethod(AnnotationMethodHandlerAdapter.java:642) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:431) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789) {code} The exception suggests that the paths are identical, which they are not. Apparently, Spring checks for path uniqueness at the method level without taking into account the base mapping at the classlevel.

    Spring JIRA | 5 years ago | marc schipperheyn
    java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path '/my/extend/post/': {public java.lang.String nlproject.controller.MyExtendController.extendPost(nl.project.VO.MyVO,org.springframework.validation.BindingResult,org.springframework.ui.ModelMap,org.springframework.web.context.request.NativeWebRequest) throws java.lang.Exception, public java.lang.String nl.project.controller.MyController.post(nl.project.VO.MyVO,org.springframework.validation.BindingResult,org.springframework.ui.ModelMap,org.springframework.web.context.request.NativeWebRequest)}. If you intend to handle the same path in multiple methods, then factor them out into a dedicated handler class with that path mapped at the type level!
  2. 0

    {code} @Controller @RequestMapping("/my") public class MyController extends ExtendedController @RequestMapping(method = RequestMethod.POST, value = "/post/") public String post( @ModelAttribute("vo") MyVO vo, BindingResult result, ModelMap model, NativeWebRequest request) throws Exception{ [...] @Controller @RequestMapping("/my/extend") public class MyController extends ExtendedController @RequestMapping(method = RequestMethod.POST, value = "/post/") public String extendPost( @ModelAttribute("vo") MyVO vo, BindingResult result, ModelMap model, NativeWebRequest request) throws Exception{ {code} This leads to {code} java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path '/my/extend/post/': {public java.lang.String nlproject.controller.MyExtendController.extendPost(nl.project.VO.MyVO,org.springframework.validation.BindingResult,org.springframework.ui.ModelMap,org.springframework.web.context.request.NativeWebRequest) throws java.lang.Exception, public java.lang.String nl.project.controller.MyController.post(nl.project.VO.MyVO,org.springframework.validation.BindingResult,org.springframework.ui.ModelMap,org.springframework.web.context.request.NativeWebRequest)}. If you intend to handle the same path in multiple methods, then factor them out into a dedicated handler class with that path mapped at the type level! at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodResolver.resolveHandlerMethod(AnnotationMethodHandlerAdapter.java:642) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:431) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789) {code} The exception suggests that the paths are identical, which they are not. Apparently, Spring checks for path uniqueness at the method level without taking into account the base mapping at the classlevel.

    Spring JIRA | 5 years ago | marc schipperheyn
    java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path '/my/extend/post/': {public java.lang.String nlproject.controller.MyExtendController.extendPost(nl.project.VO.MyVO,org.springframework.validation.BindingResult,org.springframework.ui.ModelMap,org.springframework.web.context.request.NativeWebRequest) throws java.lang.Exception, public java.lang.String nl.project.controller.MyController.post(nl.project.VO.MyVO,org.springframework.validation.BindingResult,org.springframework.ui.ModelMap,org.springframework.web.context.request.NativeWebRequest)}. If you intend to handle the same path in multiple methods, then factor them out into a dedicated handler class with that path mapped at the type level!
  3. 0

    Spring : Ambiguous handler methods mapped for HTTP path

    Stack Overflow | 7 months ago | jayjaypg22
    java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path 'http://localhost:8081/bus/topologie': {public java.lang.String fr.cnamts.navigo.web.TopologieController.genererCle(fr.cnamts.navigo.domain.Topologie,org.springframework.ui.Model) throws java.io.IOException, public java.lang.String fr.cnamts.navigo.web.TopologieController.updateNatures(fr.cnamts.navigo.domain.Topologie,org.springframework.ui.Model) throws java.io.IOException}
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    "Ambiguous handler methods mapped for HTTP path" exception in spring MVC when submitting the form a third time

    Stack Overflow | 7 months ago | jayjaypg22
    java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path 'http://localhost:8081/bus/topologie': {public java.lang.String fr.cnamts.navigo.web.TopologieController.updateNaturesPost(fr.cnamts.navigo.domain.Topologie,org.springframework.ui.Model) throws java.io.IOException, public java.lang.String fr.cnamts.navigo.web.TopologieController.genererClePost(fr.cnamts.navigo.domain.Topologie,org.springframework.ui.Model) throws java.io.IOException}
  6. 0

    SpringMVC Annotation不支持多态 - VC/MFC

    myexception.cn | 11 months ago
    java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path '/regist.action': {public org.springframework.web.servlet.ModelAndView com.action.RegistController.findStu(int,org.springframework.ui.ModelMap), public org.springframework.web.servlet.ModelAndView com.action.RegistController.findStu(int,java.lang.String,org.springframework.ui.ModelMap)}. If you intend to handle the same path in multiple methods, then factor them out into a dedicated handler class with that path mapped at the type level!

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      Ambiguous handler methods mapped for HTTP path '/my/extend/post/': {public java.lang.String nlproject.controller.MyExtendController.extendPost(nl.project.VO.MyVO,org.springframework.validation.BindingResult,org.springframework.ui.ModelMap,org.springframework.web.context.request.NativeWebRequest) throws java.lang.Exception, public java.lang.String nl.project.controller.MyController.post(nl.project.VO.MyVO,org.springframework.validation.BindingResult,org.springframework.ui.ModelMap,org.springframework.web.context.request.NativeWebRequest)}. If you intend to handle the same path in multiple methods, then factor them out into a dedicated handler class with that path mapped at the type level!

      at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodResolver.resolveHandlerMethod()
    2. Spring MVC
      FrameworkServlet.doPost
      1. org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodResolver.resolveHandlerMethod(AnnotationMethodHandlerAdapter.java:642)
      2. org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:431)
      3. org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
      4. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
      5. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
      6. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
      7. org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
      7 frames