title: Spring 3 MVC - Url mapping not found (404) in production
body: <p>My app works fine on local tomcat 7 but on the prod tomcat 7 only index url ("/") and resources urls works, other urls are not found, "/login" for example.</p>
  
  <p>servlet-context.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans:beans xmlns="http://www.springframework.org/schema/mvc"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
  xmlns:context="http://www.springframework.org/schema/context"
  xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt;
  
  &lt;annotation-driven /&gt;
  
  &lt;resources mapping="/resources/**" location="/resources/" /&gt;
  
  &lt;!-- FreeMarker Config --&gt;
  &lt;beans:bean id="freemarkerConfig"
      class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer"&gt;
      &lt;beans:property name="templateLoaderPath" value="/WEB-INF/views/" /&gt;
  &lt;/beans:bean&gt;
  
  &lt;!-- FreeMarker View Resolver --&gt;
  &lt;beans:bean id="viewResolver"
      class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"&gt;
      &lt;beans:property name="cache" value="true" /&gt;
      &lt;beans:property name="prefix" value="" /&gt;
      &lt;beans:property name="suffix" value=".html" /&gt;
  &lt;/beans:bean&gt;
  
  &lt;context:component-scan base-package="com.x.y" /&gt;
  
  &lt;/beans:beans&gt;
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
  
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;/WEB-INF/spring/root-context.xml&lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/spring/appServlet/servlet-context.xml&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Trying to resolve I changed the servlet-mapping from <code>&lt;url-pattern&gt;/&lt;/url-pattern&gt;</code> to <code>&lt;url-pattern&gt;/*&lt;/url-pattern&gt;</code> and I got no success, but it started to find the urls if I put the suffix ".jsp", eg: /login.jsp.</p>
  
  <p>Can anyone help me understand why the tomcat is waiting this ".jsp" suffix? I'm not even using jsp in my app :s</p>
  
  <p>Controller sample:</p>
  
  <pre><code>@Controller
  public class Application extends BaseController {
  
      //...
  
      @RequestMapping(value = "/", method = RequestMethod.GET)
      public String index(Model model, HttpSession session) {
          //..
          return "application/index";
      }
  
          @RequestMapping(value = "/login", method = RequestMethod.GET)
      public String login(Model model, HttpSession session) {
          //..
          return "application/login";
      }
  
      //...
  }
  </code></pre>
  
  <p>Thanks.</p>