0

Mapping to a controller method is not working. Going to http://localhost:8080/teleseminars/telesem_live returns a 404 and this shows up in the logs:

2012-10-30 11:37:58,190 [http-8086-1] [WARN ] [org.springframework.web.servlet.DispatcherServlet.noHandlerFound(DispatcherServlet.java:947)] No mapping found for HTTP request with URI [/teleseminars/telesem_live] in DispatcherServlet with name 'dispatcher'

Any help is appreciated. Thanks!

Here is the controller:

@Controller
public class TeleseminarsController {

    private final Logger logger = LoggerFactory.getLogger(getClass());

    @RequestMapping(value= "/teleseminars/{page}/{series}", method = RequestMethod.GET) ///{page}/{series}
    public String getTele(@PathVariable("page") String page,
            @PathVariable("series") String series,
            HttpServletRequest request,
            final Model model) {

                //do stuff

            return page;
    }
}

I have this on web.xml

<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>*.do</url-pattern>
    <url-pattern>/teleseminars/*</url-pattern>
</servlet-mapping>
Mechlar
  • 4,946
  • 12
  • 58
  • 83
  • Why do you have `*.do` mapping in your `servlet-mapping`? One `url-pattern` with `/*` should be enough - all requests will then be dispatched to Spring MVC. – romario333 Oct 31 '12 at 09:48
  • Thanks, @romario333 - Other methods we have are using the .do extension. This would map every URI to the spring dispatcher, which of course I cannot do. I've tried that in the past and it takes on ALL requests. All images, css, js, html, etc. all get dispatched to Spring... – Mechlar Oct 31 '12 at 14:51

3 Answers3

2

The servlet-mapping you have eats that part of it. In your controller you may have to change the @RequestMapping to @RequestMapping(value= "/{page}/{series}", method = RequestMethod.GET). I have had that problem as well.

Kodi
  • 767
  • 7
  • 20
0

You are mapping two path variables, hence http://localhost:8080/teleseminars/telesem_live/foo would match, but http://localhost:8080/teleseminars/telesem_live doesn't.

Sean Patrick Floyd
  • 292,901
  • 67
  • 465
  • 588
  • Thanks, but tried that and got: No mapping found for HTTP request with URI [/teleseminars/telesem_live/SB_0] in DispatcherServlet with name 'dispatcher' – Mechlar Oct 30 '12 at 20:17
0

could you please make sure the following line is available in your context.xml

 <context:component-scan base-package="com.yourapp.controller" />

In Spring 3 or above, you still need to enable “auto component scanning” (for controller) and declares “view resolver” manually.I too experienced this problem sometime ago.

Sasi Kathimanda
  • 1,788
  • 3
  • 25
  • 47