Announcement Announcement Module
No announcement yet.
Why doesn't my SimpleMappingExceptionResolver work? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why doesn't my SimpleMappingExceptionResolver work?

    This is my config for a SimpleMappingExceptionResolver but I cannot get it to work. When an exception occurs, I get the container's default 500 error. The value referenced in defaultErrorView exists (as far as I understand the ViewResolver - the file "/view/uncaughtException.jsp" exists).

    In the logs I see

    DispatcherServlet:529 - No HandlerExceptionResolvers found
    in servlet 'myapp': using default
    I've tried this with a bean id="exceptionResolver", with no exceptionMappings, with the prop key="Exception", all without success. Any ideas? Do I need to reference the exception resolver from another bean?

        <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
            <property name="defaultErrorView" value="uncaughtException"/>
            <property name="exceptionMappings">
                    <prop key="java.lang.Exception">uncaughtException</prop>
        <bean id="viewResolver"
            <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
            <property name="prefix" value="/view/"/>
            <property name="suffix" value=".jsp"/>
            <property name="order" value="999"/>

  • #2
    Never mind - it occurred to me after writing the question that the exceptions I'm trying to trap are security exceptions. The filtering happens before the dispatcher. I was able to verify the dispatcher is actually working. Just need to figure out how to handle security exceptions.