title: spring security 404 for access-denied-handler
body: <p>I'm trying to set up my spring mvc webapp to use the spring access-denied-handler but can't get it to catch the errors. Using my configurations it looks like spring is fowarding to the access denied handler but for some reason when my access denied handler is executed I get a 404 not found. HTTP Status 404 - /accessDenied.</p>
  
  <p>Can someone please help me to find out what might be going wrong here? I definitely have a jsp named accessDenied.jsp</p>
  
  <p><br>
      
      
      </p>
  
  <pre><code>&lt;!-- Resources --&gt;
  &lt;intercept-url pattern="/resources/css/*" access="IS_AUTHENTICATED_ANONYMOUSLY" /&gt;
  &lt;intercept-url pattern="/resources/images/*" access="IS_AUTHENTICATED_ANONYMOUSLY" /&gt;
  &lt;intercept-url pattern="/resources/js/*" access="IS_AUTHENTICATED_ANONYMOUSLY" /&gt;
  
  &lt;!-- Pages --&gt;  
  &lt;intercept-url pattern="/login" access="IS_AUTHENTICATED_ANONYMOUSLY" /&gt;
  &lt;intercept-url pattern="/accessDenied" access="IS_AUTHENTICATED_ANONYMOUSLY" /&gt;
  &lt;intercept-url pattern="/welcome" access="ROLE_LEVEL7" /&gt;
  &lt;intercept-url pattern="/priceOverride" access="ROLE_LEVEL7" /&gt; 
  
  &lt;!-- Error handlers --&gt;
  &lt;access-denied-handler ref="accessDeniedHandler" /&gt;  
  </code></pre>
  
  <p></p>
  
  <p>Then in my mvc-dispatcher-servlet...</p>
  
  <pre><code>    &lt;context:component-scan base-package="com.company.reporting.controller" /&gt;
     &lt;bean id="accessDeniedHandler" 
          class="com.company.reporting.handler.ReportingAccessDeniedHandler"&gt;
          &lt;property name="accessDeniedUrl" value="/accessDenied" /&gt;
     &lt;/bean&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;mvc:resources mapping="/resources/**" location="/resources/" /&gt;    
      &lt;mvc:annotation-driven /&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/qZBvv.png" alt="enter image description here"></p>
  
  <p>thanks</p>