I have ExeptionServlet that catches the exceptions and displays the information what I need.
I point out in web.xml
<error-page>
<exception-type>javax.servlet.ServletException</exception-type>
<location>/exception</location>
</error-page>
<error-page>
<exception-type>java.io.IOException</exception-type>
<location>/exception</location>
</error-page>
How to do without web.xml and Spring?