title: Spring MVC application - URL gives No file found (404)
body: <p>I created a Spring-MVC project.</p>
  
  <p><strong>web.xml</strong>:</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/soundmails&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p><strong>mvc-dispatcher-servlet.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:mvc="http://www.springframework.org/schema/mvc"
   xmlns:context="http://www.springframework.org/schema/context"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd      
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt;
  
  &lt;mvc:annotation-driven /&gt;
  &lt;context:component-scan base-package="somepkg.controllers" /&gt;
  
  &lt;bean id="multipartResolver" class="org.gmr.web.multipart.GMultipartResolver"&gt;
      &lt;property name="maxUploadSize" value="1048576" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
      &lt;!-- property name="location"&gt;
          &lt;value&gt;/WEB-INF/social.properties&lt;/value&gt;
      &lt;/property--&gt;
  &lt;/bean&gt;
  &lt;bean id="jacksonMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"&gt;&lt;/bean&gt;
  &lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt;
      &lt;property name="messageConverters"&gt;
          &lt;list&gt;
              &lt;ref bean="jacksonMessageConverter"/&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>The controller has this code:
  <strong>ProjectController.java</strong></p>
  
  <pre><code>@Controller
  @RequestMapping("/soundmails")
  public class FileUploadController {
      @RequestMapping(value="/test", method=RequestMethod.GET)
      public @ResponseBody String test() {
          System.out.println("Hai");
          return "Hai";
      }
  }
  </code></pre>
  
  <p>I am using Google App Engine in my local machine to test this.  I am getting these in my log:</p>
  
  <blockquote>
    <p>[INFO] Oct 24, 2013 1:54:18 AM com.google.appengine.tools.development.LocalResourceFileServlet doGet
    [INFO] WARNING: No file found for: /soundmails/test</p>
  </blockquote>
  
  <p>I tried /soundmails/soundmails/test as well. That is also giving the same error.</p>
  
  <p>I am using Spring 3.1.0.RELEASE</p>
  
  <p>Can someone help me figure out what I am missing - /soundmails/test is giving 404 error.</p>
  
  <p>Edit</p>
  
  <p>I am unable to enable DEBUG logs for this.  For some reason, it is not taking log level configured in <code>logging.properties</code></p>
  
  <p>But I observed something interesting:</p>
  
  <p>1) If I map the request to empty string (<code>value = ""</code>)</p>
  
  <pre><code>@RequestMapping(value="", method=RequestMethod.GET)
  public @ResponseBody String test() {
      System.out.println("Hai");
      return "Hai";
  }
  </code></pre>
  
  <p>Then, when I try to access 127.0.0.1/soundmails, it works fine (returns string "Hai").</p>
  
  <p>2) When I have <code>value="/test"</code></p>
  
  <pre><code>@RequestMapping(value="/test", method=RequestMethod.GET)
  public @ResponseBody String test() {
      System.out.println("Hai");
      return "Hai";
  }
  </code></pre>
  
  <p>and I try to access 127.0.0.1/soundmails/test, it is giving HTTP 404.  This is weird.</p>