org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path 'http://localhost:8111/storefront/': {public java.lang.String com.xxxx.storefront.controllers.pages.HomePageController.home(org.springframework.ui.Model,java.lang .String,javax.servlet.http.HttpServletRequest), public org.springframework.http.HttpEntity org.springframework.data.rest.webmvc.RepositoryController.listRepositories()}

Spring JIRA | Petar Tahchiev | 2 years ago
  1. 0

    So before I get to the point I have to explain my setup. I have a jar (called {{restservices.jar}}) which holds all my spring repositories and rest configuration. This jar is mapped under it's own web-config under {{/rest/}} {code} /* Spring REST Delegating Dispatcher Servlet */ Servlet restDispatcherServlet = new RepositoryRestDispatcherServlet(webCtx); ServletRegistration.Dynamic restDispatcherServletReg = servletContext.addServlet("restDispatcherServlet", restDispatcherServlet); restDispatcherServletReg.setLoadOnStartup(1); restDispatcherServletReg.addMapping("/rest/*"); {code} I also have a webapplication in a war file (called storefront.war) and the user has the ability to include the {{restservices.jar}} in {{WEB-INF/lib}}. The storefront is mapped under {{/}}: {code} final Servlet dispatcherServlet = new DispatcherServlet(webCtx); final ServletRegistration.Dynamic dispatcherServletReg = servletContext.addServlet("dispatcherServlet", dispatcherServlet); dispatcherServletReg.setInitParameter("contextConfigLocation", ""); dispatcherServletReg.setLoadOnStartup(1); dispatcherServletReg.addMapping("/"); {code} So far it all worked fine - user can open the {{/storefront}} and see the storefront and also open the {{/storefront/rest}} and use the rest. But because I'm building with the latest SNAPSHOT it all broke down yesterday. Now when the user opens the {{/storefront}} they see an exception: {code} org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path 'http://localhost:8111/storefront/': {public java.lang.String com.xxxx.storefront.controllers.pages.HomePageController.home(org.springframework.ui.Model,java.lang .String,javax.servlet.http.HttpServletRequest), public org.springframework.http.HttpEntity org.springframework.data.rest.webmvc.RepositoryController.listRepositories()} at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:973) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:711) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1644) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) ... {code} And I believe it is because of this commit: https://github.com/spring-projects/spring-data-rest/commit/e70285331c3270d88fe47a576c13bcae795763a8#diff-56747b96ce7be9e2c805687d47b49b54 Please confirm if it's a bug and fix it if it is :) Thanks

    Spring JIRA | 2 years ago | Petar Tahchiev
    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path 'http://localhost:8111/storefront/': {public java.lang.String com.xxxx.storefront.controllers.pages.HomePageController.home(org.springframework.ui.Model,java.lang .String,javax.servlet.http.HttpServletRequest), public org.springframework.http.HttpEntity org.springframework.data.rest.webmvc.RepositoryController.listRepositories()}
  2. 0

    So before I get to the point I have to explain my setup. I have a jar (called {{restservices.jar}}) which holds all my spring repositories and rest configuration. This jar is mapped under it's own web-config under {{/rest/}} {code} /* Spring REST Delegating Dispatcher Servlet */ Servlet restDispatcherServlet = new RepositoryRestDispatcherServlet(webCtx); ServletRegistration.Dynamic restDispatcherServletReg = servletContext.addServlet("restDispatcherServlet", restDispatcherServlet); restDispatcherServletReg.setLoadOnStartup(1); restDispatcherServletReg.addMapping("/rest/*"); {code} I also have a webapplication in a war file (called storefront.war) and the user has the ability to include the {{restservices.jar}} in {{WEB-INF/lib}}. The storefront is mapped under {{/}}: {code} final Servlet dispatcherServlet = new DispatcherServlet(webCtx); final ServletRegistration.Dynamic dispatcherServletReg = servletContext.addServlet("dispatcherServlet", dispatcherServlet); dispatcherServletReg.setInitParameter("contextConfigLocation", ""); dispatcherServletReg.setLoadOnStartup(1); dispatcherServletReg.addMapping("/"); {code} So far it all worked fine - user can open the {{/storefront}} and see the storefront and also open the {{/storefront/rest}} and use the rest. But because I'm building with the latest SNAPSHOT it all broke down yesterday. Now when the user opens the {{/storefront}} they see an exception: {code} org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path 'http://localhost:8111/storefront/': {public java.lang.String com.xxxx.storefront.controllers.pages.HomePageController.home(org.springframework.ui.Model,java.lang .String,javax.servlet.http.HttpServletRequest), public org.springframework.http.HttpEntity org.springframework.data.rest.webmvc.RepositoryController.listRepositories()} at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:973) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:711) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1644) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) ... {code} And I believe it is because of this commit: https://github.com/spring-projects/spring-data-rest/commit/e70285331c3270d88fe47a576c13bcae795763a8#diff-56747b96ce7be9e2c805687d47b49b54 Please confirm if it's a bug and fix it if it is :) Thanks

    Spring JIRA | 2 years ago | Petar Tahchiev
    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path 'http://localhost:8111/storefront/': {public java.lang.String com.xxxx.storefront.controllers.pages.HomePageController.home(org.springframework.ui.Model,java.lang .String,javax.servlet.http.HttpServletRequest), public org.springframework.http.HttpEntity org.springframework.data.rest.webmvc.RepositoryController.listRepositories()}
  3. 0

    Spring EntityManager.find throws NullPointerException

    Stack Overflow | 6 months ago | Timofey
    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Ribbon with Spring Cloud and Eureka: java.lang.IllegalStateException: No instances available for Samarths-MacBook-Pro.local

    Stack Overflow | 1 year ago | Samarth
    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: No instances available for Samarths-MacBook-Pro.local

  1. kid 4 times, last 8 months ago
  2. tvrmsmith 4 times, last 5 months ago
  3. qavid 1 times, last 5 months ago
20 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. org.springframework.web.util.NestedServletException

    Request processing failed; nested exception is java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path 'http://localhost:8111/storefront/': {public java.lang.String com.xxxx.storefront.controllers.pages.HomePageController.home(org.springframework.ui.Model,java.lang .String,javax.servlet.http.HttpServletRequest), public org.springframework.http.HttpEntity org.springframework.data.rest.webmvc.RepositoryController.listRepositories()}

    at org.springframework.web.servlet.FrameworkServlet.processRequest()
  2. Spring MVC
    FrameworkServlet.doGet
    1. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:973)
    2. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
    2 frames
  3. JavaServlet
    HttpServlet.service
    1. javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
    1 frame
  4. Spring MVC
    FrameworkServlet.service
    1. org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
    1 frame
  5. JavaServlet
    HttpServlet.service
    1. javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    1 frame
  6. Jetty
    ServletHandler$CachedChain.doFilter
    1. org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:711)
    2. org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1644)
    2 frames
  7. Spring Security
    FilterChainProxy$VirtualFilterChain.doFilter
    1. org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    2. org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
    3. org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
    4. org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    5. org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
    6. org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    6 frames