Take the 2-minute tour ×

In my Spring app, I have the following:

@RequestMapping(method = RequestMethod.GET, value = "/")
public String goHome(ModelMap map){
    map.addAttribute("content", "home.jsp");
    return "index";

@RequestMapping(method = RequestMethod.GET, value = "register")
public String getRegisterPage(ModelMap map){
    map.addAttribute("content", "register.jsp");
    return "index";

On localhost, I can access them as localhost:8080 and localhost:8080/register respectively. But when I deploy them on third party server, domain.com works fine but domain.com/register (and every other links other than domain.com) result in a 404.

Not Found

The requested URL /register was not found on this server.


- Both localhost and domain.com run on Tomcat 5.5 and has Servlet version 2.4
- I even changed RequestMapping value to value="/register" but nothing changed


<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

Thanks for help

share|improve this question
Anything in the server logs with DEBUG logging? –  Dave Newton Nov 13 '11 at 4:53
add comment

1 Answer

up vote 1 down vote accepted

Got my answer here: Tomcat 404 Not Found error

The problem is that in the production environment tomcat is being fronted by an apache httpd which does not forward requests to tomcat for urls of the form /foobar (without an extension). Apache doesn't know how to deal with those URLs and tries to serve them as static files from the disk. The files are not there so it tries to execute the 404 rule which is badly configured (the configured 404 file is itself missing as well - but that's another problem).


Assign an extension to all your servlets and specify that to apache. E.g .do (like struts does) so your servlet becomes /foobar.do. You'll then need to ask your sysadmin to specify that *.do goes to tomcat. Ask your sysadmin to configure apache to send all requests to tomcat apart of those for static files. E.g *.jpg, *.png, *.css, *.js etc

In my case, it worked fine with urls like /register.do :)

share|improve this answer
add comment

Your Answer


