title: Spring MVC: Controller RequestMapping working, but return always gives a 404
body: <p>I have a couple of SYSOUTs in my controller's methods, and they appear in the console log... verifying for me that all of the @RequestMapping is behaving as expected.  The @Autowiring of an environment bean is also working (is also correctly displayed by a SYSOUT).</p>
  
  <p>However, the methods' returns (I am using methods that return String type) are only resulting in 404s. The *.jsps aren't found. Project is using Maven; IDE is eclipse kepler, FWIW. </p>
  
  <p>My ViewResolver is bog-standard.  Can't see the disconnect.</p>
  
  <p><strong>My web.xml:</strong></p>
  
  <pre>
  &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br/>&lt;web-app version=&quot;2.5&quot; xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot;<br/>   xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br/>    xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;&gt;<br/><br/>    &lt;display-name&gt;BluPrint&lt;/display-name&gt;<br/><br/> &lt;servlet&gt;<br/>        &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;<br/>        &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;<br/>       &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;<br/>   &lt;/servlet&gt;<br/><br/>  &lt;servlet-mapping&gt;<br/>        &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;<br/>        &lt;url-pattern&gt;/*&lt;/url-pattern&gt;<br/>  &lt;/servlet-mapping&gt;<br/><br/>  &lt;context-param&gt;<br/>      &lt;param-name&gt;groupId&lt;/param-name&gt;<br/>       &lt;param-value&gt;${project.groupId}&lt;/param-value&gt;<br/>  &lt;/context-param&gt;<br/><br/>    &lt;context-param&gt;<br/>      &lt;param-name&gt;artifactId&lt;/param-name&gt;<br/>        &lt;param-value&gt;${project.artifactId}&lt;/param-value&gt;<br/>   &lt;/context-param&gt;<br/><br/>&lt;/web-app&gt;</pre>
  
  <p><b>My servlet.xml:</b></p>
  
  <pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br/>&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;<br/>  xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:p=&quot;http://www.springframework.org/schema/p&quot;<br/>    xmlns:context=&quot;http://www.springframework.org/schema/context&quot;<br/>    xmlns:aop=&quot;http://www.springframework.org/schema/aop&quot; xmlns:jee=&quot;http://www.springframework.org/schema/jee&quot;<br/>    xmlns:tx=&quot;http://www.springframework.org/schema/tx&quot; xmlns:util=&quot;http://www.springframework.org/schema/util&quot;<br/>    xmlns:batch=&quot;http://www.springframework.org/schema/batch&quot; xmlns:task=&quot;http://www.springframework.org/schema/task&quot;<br/>  xmlns:mvc=&quot;http://www.springframework.org/schema/mvc&quot; xmlns:xjp=&quot;http://www.corpabc.com/schema/xjp&quot;<br/>    xsi:schemaLocation=&quot;<br/>   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd<br/>   http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd<br/>   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd<br/>   http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd<br/>   http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd<br/>   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd<br/>   http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd<br/>   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd<br/>   http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd<br/>   http://www.corpabc.com/schema/xjp http://www.corpabc.com/schema/xjp/beans.xsd&quot;&gt;<br/><br/>   &lt;context:component-scan base-package=&quot;com.corpabc.bluprint&quot; /&gt;<br/> <br/>   &lt;mvc:annotation-driven /&gt;<br/>    &lt;mvc:resources mapping=&quot;/resources/**&quot; location=&quot;/resources/&quot; /&gt;<br/> <br/>   &lt;import resource=&quot;classpath:corpabc/xjp/configuration/properties.xml&quot; /&gt;<br/><br/>  &lt;bean id=&quot;viewResolver&quot; class=&quot;org.springframework.web.servlet.view.InternalResourceViewResolver&quot;&gt;<br/>       &lt;property name=&quot;viewClass&quot;<br/>            value=&quot;org.springframework.web.servlet.view.JstlView&quot; /&gt;<br/>      &lt;property name=&quot;prefix&quot; value=&quot;/WEB-INF/jsp/&quot; /&gt;<br/>     &lt;property name=&quot;suffix&quot; value=&quot;.jsp&quot; /&gt;<br/>  &lt;/bean&gt;<br/><br/> &lt;bean id=&quot;dataSourceDB2&quot; class=&quot;org.springframework.jndi.JndiObjectFactoryBean&quot;&gt;<br/>     &lt;property name=&quot;jndiName&quot; value=&quot;jdbc/BluPrint&quot; /&gt;<br/>       &lt;property name=&quot;resourceRef&quot; value=&quot;true&quot; /&gt;<br/> &lt;/bean&gt;<br/><br/> &lt;xjp:environment artifactId=&quot;${artifactId}&quot; groupId=&quot;${groupId}&quot; /&gt;<br/><br/>&lt;/beans&gt;
  </pre>
  
  <p><b>My Controller:</b></p>
  
  <pre><code>package com.corpabc.bluprint.controllers;
  import java.util.Map;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.servlet.ModelAndView;
  import corpabc.xjp.configuration.env.Environment;
  
  /**
   * 
   * Handles requests for the application.
   */
  
  @Controller
  @RequestMapping("/*")
  public class BluPrintController {
  
      @Autowired
      private Environment xjpEnvironment;
  
      @RequestMapping("/init")
      protected String catchInit(Map&lt;String, Object&gt; model) {
          System.out.println("Got into init method.  XJP Environment: "+xjpEnvironment);
          model.put("xjp", this.xjpEnvironment);
          return "envtest";
      }
  
      @RequestMapping("/*")
      protected String catchAllOthers(Map&lt;String, Object&gt; model) {
          System.out.println("Got into catch-all method: ");
          return "defaultPage";
      }
  }
  </code></pre>
  
  <p>My <code>envtest.jsp</code> is under <code>/WEB-INF/jsp/</code> ... but entering URL <code>~localhost:8080/bluprint/init</code> ... I get a 404.</p>
  
  <p>My <code>defaultPage.jsp</code> doesn't exist... I would expect a not found condition here, and that's what I get when I enter <code>~localhost:8080/bluprint/</code> .  Not sure if it should be a 404, specifically, but that's what I get, in any case.</p>