I have J2EE application(I am using Struts2 / EJB3.0). I have used the below code in web.xml to catch the 500 error,
If 500 error is caused by my JSP (meaning i missed some tags/ some error in jsp) i am redirected to my custom error page. But if there is some error in my action / network time out / null pointer exception i am not redirected to my custom error page instead i get HTTP INTERNAL SERVER ERROR.
Please let me know if i have to any other configuration in web.xml for me to get redirected to my custom error page.
If you use java.lang.Throwable instead of java.lang.Exception, it can handle all of the exceptions, and 5xx errors (but not 4xx errors). For handling 4xx errors, you should use separate error-page declaration with proper error-code specifications.
subject: Redirect internal server error to custom JSP