title: Spring MVC project local resource
body: <p>I'm trying to implement <a href="https://stackoverflow.com/questions/8041839/spring-mvcresources-access-to-outside-folder">this</a> to my project. I'll be having a local resources inside <code>C:\resource\pdf\</code>.</p>
  
  <p><b>Update:</b></p>
  
  <p>My previous configuration is working well:</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"
     xsi:schemaLocation="
     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;context:component-scan base-package="com.neu.als.thesis.web.controllers" /&gt;
  
    &lt;!--  Resolves view names to protected .jsp resources within the /WEB-INF/views directory --&gt; 
    &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="prefix" value="/WEB-INF/" /&gt;
      &lt;property name="suffix" value=".jsp" /&gt;
    &lt;/bean&gt;
  
    &lt;!-- Configure the multipart resolver --&gt;
    &lt;bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"&gt;
      &lt;!-- one of the properties available; the maximum file size in bytes --&gt;
      &lt;property name="maxUploadSize" value="10000000"/&gt;
    &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>And modify it to implement the local resource to this:</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:context="http://www.springframework.org/schema/context" 
     xmlns:mvc="http://www.springframework.org/schema/mvc"
     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/context 
     http://www.springframework.org/schema/context/spring-context-3.0.xsd
     http://www.springframework.org/schema/mvc 
          http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"&gt;
  
    &lt;context:component-scan base-package="com.neu.als.thesis.web.controllers" /&gt;
  
    &lt;mvc:resources mapping="/picture/**" location="file:/resource/" /&gt;
  
    &lt;!--  Resolves view names to protected .jsp resources within the /WEB-INF/views directory --&gt; 
    &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="prefix" value="/WEB-INF/" /&gt;
      &lt;property name="suffix" value=".jsp" /&gt;
    &lt;/bean&gt;
  
    &lt;!-- Configure the multipart resolver --&gt;
    &lt;bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"&gt;
      &lt;!-- one of the properties available; the maximum file size in bytes --&gt;
      &lt;property name="maxUploadSize" value="10000000"/&gt;
    &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>But when I run the project a <code>404</code> error is thrown. And the last few lines at my console is:</p>
  
  <pre><code>Nov 02, 2013 8:12:21 PM org.springframework.web.servlet.PageNotFound noHandlerFound
  WARNING: No mapping found for HTTP request with URI [/ThesisProject/] in DispatcherServlet with name 'ThesisProject'
  </code></pre>
  
  <p>Seems the default controller can't be located. What am I missing?</p>
  
  <p><b>Update 2</b></p>
  
  <p>here is my servlet definition in <code>web.xml</code></p>
  
  <pre><code>&lt;!-- Servlet definition --&gt;
    &lt;servlet&gt;
        &lt;servlet-name&gt;ThesisProject&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;ThesisProject&lt;/servlet-name&gt;
        &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  
    &lt;context-param&gt;
       &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
       &lt;param-value&gt;/WEB-INF/ThesisProject-servlet.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;
  </code></pre>