title: spring mvc 3 (3.2.5) + tiles 3 error 404 not resource found
body: <p>when i load my app i get only 404 resource not found error.. no logs on tomcat at all.. </p>
  
  <p>here you can see my project configuration:</p>
  
  <p><img src="https://i.stack.imgur.com/lrOQ7.png" alt="This is the structure of my project"></p>
  
  <p>this 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_2_5.xsd"
           id="WebApp_ID" version="2.5"&gt;
  
      &lt;display-name&gt;Spring Web MVC Application&lt;/display-name&gt;
  
      &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;/pages/*&lt;/url-pattern&gt;
          &lt;!--url-pattern&gt;*.jsp&lt;/url-pattern--&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;urlrewrite default-match-type="wildcard"&gt;
      &lt;rule&gt;
          &lt;from&gt;/&lt;/from&gt;
          &lt;to&gt;/pages/&lt;/to&gt;
      &lt;/rule&gt;
      &lt;rule&gt;
          &lt;from&gt;/**&lt;/from&gt;
          &lt;to&gt;/pages/$1&lt;/to&gt;
      &lt;/rule&gt;
      &lt;outbound-rule&gt;
          &lt;from&gt;/pages/**&lt;/from&gt;
          &lt;to&gt;/$1&lt;/to&gt;
      &lt;/outbound-rule&gt;
      &lt;/urlrewrite&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;urlRewriteFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;org.tuckey.web.filters.urlrewrite.UrlRewriteFilter&lt;/filter-class&gt;
      &lt;/filter&gt;
  
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;urlRewriteFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
  
  
  
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/mvc-dispatcher-servlet.xml,
                       /WEB-INF/spring-security.xml,
                       /WEB-INF/spring-database.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;!-- Spring Security --&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
          &lt;filter-class&gt;
              org.springframework.web.filter.DelegatingFilterProxy
          &lt;/filter-class&gt;
      &lt;/filter&gt;
  
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;/index.jsp&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>tiles.xml file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE tiles-definitions PUBLIC
          "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
          "http://tiles.apache.org/dtds/tiles-config_2_0.dtd"&gt;
  
  &lt;tiles-definitions&gt;
      &lt;definition name="base.definition"
                  template="/WEB-INF/pages/layout.jsp"&gt;
          &lt;put-attribute name="title" value="" /&gt;
          &lt;put-attribute name="header" value="/WEB-INF/pages/header.jsp" /&gt;
          &lt;put-attribute name="menu" value="/WEB-INF/pages/menu.jsp" /&gt;
          &lt;put-attribute name="body" value="" /&gt;
          &lt;put-attribute name="footer" value="/WEB-INF/pages/footer.jsp" /&gt;
      &lt;/definition&gt;
  
      &lt;definition name="contact" extends="base.definition"&gt;
          &lt;put-attribute name="title" value="Contact Manager" /&gt;
          &lt;put-attribute name="body" value="/WEB-INF/pages/prueba2.jsp" /&gt;
      &lt;/definition&gt;
  
  &lt;/tiles-definitions&gt;
  </code></pre>
  
  <p>mvc-dispatcher-servlet.xml </p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:context="http://www.springframework.org/schema/context"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
         xsi:schemaLocation="
          http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
          http://www.springframework.org/schema/beans     
          http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
          http://www.springframework.org/schema/context 
          http://www.springframework.org/schema/context/spring-context-3.2.xsd"&gt;
  
      &lt;context:component-scan base-package="com.mkyong.common.controller" /&gt;
  
      &lt;bean
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;property name="prefix"&gt;
              &lt;value&gt;/WEB-INF/pages/&lt;/value&gt;
  
          &lt;/property&gt;
          &lt;property name="suffix"&gt;
              &lt;value&gt;.jsp&lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="messageSource"
            class="org.springframework.context.support.ResourceBundleMessageSource"&gt;
          &lt;property name="basenames"&gt;
              &lt;list&gt;
                  &lt;value&gt;mymessages&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
  
      &lt;bean id="viewResolver"
            class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
          &lt;property name="viewClass"&gt;
              &lt;value&gt;
                  org.springframework.web.servlet.view.tiles3.TilesView
              &lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
      &lt;bean id="tilesConfigurer"
            class="org.springframework.web.servlet.view.tiles3.TilesConfigurer"&gt;
          &lt;property name="definitions"&gt;
              &lt;list&gt;
                  &lt;value&gt;/WEB-INF/tiles.xml&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
  
      &lt;mvc:annotation-driven /&gt;
  
      &lt;mvc:resources mapping="/resources/**" location="/resources/" /&gt;
  
      &lt;context:annotation-config /&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>spring-security.xml</p>
  
  <pre><code>&lt;beans:beans xmlns="http://www.springframework.org/schema/security"
               xmlns:beans="http://www.springframework.org/schema/beans" 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.2.xsd
      http://www.springframework.org/schema/security
      http://www.springframework.org/schema/security/spring-security-3.0.3.xsd"&gt;
  
      &lt;!--import resource="../database/spring-database.xml"/--&gt;
  
  
      &lt;http auto-config="true" access-denied-page="/accessDenied"&gt;
  
          &lt;intercept-url pattern="/login*" access="IS_AUTHENTICATED_ANONYMOUSLY"/&gt;
          &lt;intercept-url pattern="/*" access="ROLE_USER" /&gt;
          &lt;form-login login-page="/login" default-target-url="/prueba2"
                      authentication-failure-url="/loginfailed.jsp"/&gt;
          &lt;logout logout-success-url="/logout" /&gt;
      &lt;/http&gt;
  
      &lt;authentication-manager&gt;
          &lt;authentication-provider&gt;
  
              &lt;jdbc-user-service data-source-ref="dataSource"
  
                                 users-by-username-query="
                      select username,password, enabled
                      from users where USERNAME=?"
  
                                 authorities-by-username-query="
                      select u.username, ur.authority from users u, user_roles ur
                      where u.user_id = ur.user_id and u.username =?  "
  
                      /&gt;
          &lt;/authentication-provider&gt;
      &lt;/authentication-manager&gt;
  
  
  &lt;/beans:beans&gt;
  </code></pre>
  
  <p>this is my controller:</p>
  
  <pre><code>@Controller
  @RequestMapping("/prueba2")
  public class controller2 extends AbstractController {
  
      Stock stock=new Stock();
      List stockList=new ArrayList&lt;Stock&gt;();
      ApplicationContext appContext = new ClassPathXmlApplicationContext("spring/config/BeanLocations.xml");
      StockBo stockBo = (StockBo)appContext.getBean("stockBo");
  
  
     /*@RequestMapping(method = RequestMethod.GET)
      public Stock returnCustomer(ModelMap model) {
          stock=stockBo.findByStockCode("7668");
          model.addAttribute("miStock", stock);
          return stock;
  
  
      }*/
  
  
  
  
  
      protected ModelAndView handleRequestInternal (HttpServletRequest req, HttpServletResponse res) throws Exception{
          User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
          String name = user.getUsername();
          Map&lt;String, Object&gt; model = new HashMap&lt;String, Object&gt;();
          stockList=stockBo.findAll();
          stock=stockBo.findByStockCode("7668");
          model.put("listaStock",stockList);
          model.put("miStock", stock);
          model.put("nombreUsuario", name);
          System.out.println("lista objetos---&gt;" + stockList.toString());
          return new ModelAndView( "prueba2", "model", model );
      }
  
      public StockBo getStockBo() {
          return stockBo;
      }
  
      public void setStockBo(StockBo stockBo) {
          this.stockBo = stockBo;
      }
  }
  </code></pre>