title: 404 error on running the spring mvc application
body: <p>I have a simple spring mvc, security and tiles application which is working, but it was not loading css and js file. I have added <code>&lt;mvc:resources mapping="/resources/**" location="/resources/" /&gt;</code> in <code>*-servlet.xml</code> file. In source I could see that JS and css are getting loaded but, actual application is giving 404 error.</p>
  
  <p><strong><a href="https://i.stack.imgur.com/eEILo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eEILo.png" alt="Project Structure"></a></strong></p>
  
  <p><strong>web.xml</strong></p>
  
  <pre><code>&lt;web-app id="WebApp_ID" version="2.4"
      xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
      http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt;
  
      &lt;display-name&gt;Spring Security Application&lt;/display-name&gt;
  
      &lt;!-- Spring MVC --&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;/&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;
              /WEB-INF/spring-security.xml,
              /WEB-INF/spring-database.xml
          &lt;/param-value&gt;
      &lt;/context-param&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;/web-app&gt;
  </code></pre>
  
  <p><strong>mvc-dispatcher-servlet.xml</strong> 
  Please Note that If I remove "" from mvc-dispatcher-servlet.xml, it is working fine but css and js files are not loading.</p>
  
  <pre><code>&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.xsd
          http://www.springframework.org/schema/mvc 
          http://www.springframework.org/schema/mvc/spring-mvc.xsd
          http://www.springframework.org/schema/context 
          http://www.springframework.org/schema/context/spring-context.xsd"&gt;
  
  
      &lt;context:component-scan base-package="com.mkyong.*" /&gt;
      &lt;mvc:resources mapping="/resources/**" location="/resources/" /&gt;
      &lt;!-- &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; --&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.tiles2.TilesView
              &lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
      &lt;bean id="tilesConfigurer"
          class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"&gt;
          &lt;property name="definitions"&gt;
              &lt;list&gt;
                  &lt;value&gt;/WEB-INF/config/tiles.xml&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>Please help me with this issue.</p>