title: Simple Servlet mapping
body: <p>I am trying to implement Spring onto a small app.
  I am getting the following:</p>
  
  <pre><code>WARNING: No mapping found for HTTP request with URI [/audiClave/] in DispatcherServlet with name 'appServlet'
  </code></pre>
  
  <p>Here is my web.xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns="http://java.sun.com/xml/ns/javaee" 
      xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
      http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
      id="WebApp_ID" 
      version="3.0"&gt;
      &lt;display-name&gt;audiClave&lt;/display-name&gt;
  &lt;!-- Processes application requests --&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>And here is the servlet-context.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:mvc="http://www.springframework.org/schema/mvc"
  xmlns:context="http://www.springframework.org/schema/context"
  xsi:schemaLocation="
      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt;
  
  &lt;!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure --&gt;
  
  &lt;!-- Scans within the base package of the application for @Components to configure as beans --&gt;
  &lt;!-- @Controller, @Service, @Configuration, etc. --&gt;
  &lt;context:component-scan base-package="com.audiClave.Service" /&gt;
  
  &lt;!-- Enables the Spring MVC @Controller programming model --&gt;
  &lt;mvc:annotation-driven /&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>The controller is:</p>
  
  <pre><code>package com.audiClave.Service;
  
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  
  /**
   * Handles requests for the application home page.
   */
  @Controller
  public class HomeController {
  
  @RequestMapping(value = "/")
  public String home() {
      System.out.println("HomeController: Passing through...");
      return "WEB-INF/views/home.jsp";
  }
  }   
  </code></pre>
  
  <p><a href="http://localhost:8080/audiClave/" rel="nofollow">http://localhost:8080/audiClave/</a> returns:</p>
  
  <pre><code>HTTP Status 404
  The requested resource () is not available.
  </code></pre>
  
  <p>I am running under eclipse using tomcat 7.0.12 and spring 3.0.5. The content appears to be correctly deployed to E:\development\java.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\audiClave</p>
  
  <p>When I changed the mapping to /* it was able to find the controller, but then the home.jsp doesn't work because the wild card matches it as well</p>
  
  <p>RESOLVED when I took the /* out of the mapping again.
  Thanks</p>