title: Spring MVC SimpleMappingExceptionResolver not resolving view when using ContentNegotiatingViewResolver
body: <p>I've got a configuration that's very similar to the spring-petclinic application and it seems like <code>SimpleMappingExceptionResolver</code> is working correctly and resolving to the view "error", but is not playing nicely with <code>ContentNegotiatingViewResolver</code> to resolve that view:</p>
  
  <pre><code>javax.servlet.ServletException: Could not resolve view with name 'error' in servlet with name 'audit'
  org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1204)
  org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)
  ...
  </code></pre>
  
  <p>Here's the DEBUG log:</p>
  
  <pre><code>2014-11-13 14:58:24,249 DEBUG org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver - Resolving exception from handler [public void com.foo.AuditGeneratorController.auditMessage(java.io.Writer,javax.servlet.http.HttpServletRequest) throws java.io.IOException]: com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting for a server that matches AnyServerSelector{}. Client view of cluster state is {type=Unknown, servers=[{address=localhost:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException: Connection refused}}]
  2014-11-13 14:58:24,250 DEBUG org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver - Resolving exception from handler [public void com.foo.AuditGeneratorController.auditMessage(java.io.Writer,javax.servlet.http.HttpServletRequest) throws java.io.IOException]: com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting for a server that matches AnyServerSelector{}. Client view of cluster state is {type=Unknown, servers=[{address=localhost:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException: Connection refused}}]
  2014-11-13 14:58:24,250 DEBUG org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver - Resolving exception from handler [public void com.foo.AuditGeneratorController.auditMessage(java.io.Writer,javax.servlet.http.HttpServletRequest) throws java.io.IOException]: com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting for a server that matches AnyServerSelector{}. Client view of cluster state is {type=Unknown, servers=[{address=localhost:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException: Connection refused}}]
  2014-11-13 14:58:24,250 DEBUG org.springframework.web.servlet.handler.SimpleMappingExceptionResolver - Resolving exception from handler [public void com.foo.AuditGeneratorController.auditMessage(java.io.Writer,javax.servlet.http.HttpServletRequest) throws java.io.IOException]: com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting for a server that matches AnyServerSelector{}. Client view of cluster state is {type=Unknown, servers=[{address=localhost:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException: Connection refused}}]
  2014-11-13 14:58:24,250 DEBUG org.springframework.web.servlet.handler.SimpleMappingExceptionResolver - Resolving to default view 'error' for exception of type [com.mongodb.MongoTimeoutException]
  2014-11-13 14:58:24,250 DEBUG org.springframework.web.servlet.handler.SimpleMappingExceptionResolver - Exposing Exception as model attribute 'exception'
  2014-11-13 14:58:24,251 DEBUG org.springframework.web.servlet.DispatcherServlet - Handler execution resulted in exception - forwarding to resolved error view: ModelAndView: reference to view with name 'error'; model is {exception=com.mongodb.MongoTimeoutException: ... (STACK TRACE SNIPPED)
  2014-11-13 14:58:24,253 DEBUG org.springframework.web.accept.FixedContentNegotiationStrategy - Requested media types is text/html (based on default MediaType)
  2014-11-13 14:58:24,253 DEBUG org.springframework.web.servlet.view.ContentNegotiatingViewResolver - Requested media types are [] based on Accept header types and producible media types [application/json, application/xml])
  2014-11-13 14:58:24,255 DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Invoking afterPropertiesSet() on bean with name 'error'
  2014-11-13 14:58:24,255 DEBUG org.springframework.web.servlet.view.ContentNegotiatingViewResolver - No acceptable view found; returning null
  2014-11-13 14:58:24,255 DEBUG org.springframework.web.servlet.DispatcherServlet - Could not complete request
  javax.servlet.ServletException: Could not resolve view with name 'error' in servlet with name 'audit'
      at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1204)
      at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952)
  </code></pre>
  
  <p>Here's the view resolver config:</p>
  
  <pre><code>&lt;!-- - The ContentNegotiatingViewResolver delegates to the InternalResourceViewResolver 
      and BeanNameViewResolver, - and uses the requested media type (determined 
      by the path extension) to pick a matching view. - When the media type is 
      'text/html', it will delegate to the InternalResourceViewResolver's JstlView, 
      - otherwise to the BeanNameViewResolver. --&gt;
  &lt;bean
      class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"&gt;
      &lt;property name="contentNegotiationManager" ref="cnManager" /&gt;
  
      &lt;property name="viewResolvers"&gt;
          &lt;list&gt;
              &lt;!-- Default viewClass: JSTL view (JSP with html output) --&gt;
              &lt;bean
                  class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
                  &lt;!-- Example: a logical view name of 'vets' is mapped to '/WEB-INF/jsp/vets.jsp' --&gt;
                  &lt;property name="prefix" value="/WEB-INF/jsp/" /&gt;
                  &lt;property name="suffix" value=".jsp" /&gt;
              &lt;/bean&gt;
  
              &lt;!-- Used here for 'xml' and 'atom' views --&gt;
              &lt;bean class="org.springframework.web.servlet.view.BeanNameViewResolver" /&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;!-- Simple strategy: only path extension is taken into account --&gt;
  &lt;bean id="cnManager"
      class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean"&gt;
      &lt;property name="favorPathExtension" value="true" /&gt;
      &lt;property name="ignoreAcceptHeader" value="true" /&gt;
      &lt;property name="defaultContentType" value="text/html" /&gt;
  
      &lt;property name="mediaTypes"&gt;
          &lt;map&gt;
              &lt;entry key="html" value="text/html" /&gt;
              &lt;entry key="xml" value="application/xml" /&gt;
              &lt;entry key="atom" value="application/atom+xml" /&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>