java.lang.IllegalStateException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • {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.
    via by marc schipperheyn,
  • {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.
    via by marc schipperheyn,
  • SpringMVC Annotation不支持多态 - VC/MFC
    via by Unknown author,
    • 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)

    Users with the same issue

    Михайло Тітов
    5 times, last one,
    Unknown visitor2 times, last one,