[undertow-dev] Undertow not handling servlet exceptions properly

Stuart Douglas sdouglas at redhat.com
Wed May 21 11:41:51 EDT 2014


This does sound like a bug.

Stuart

Dragan Jotanovic wrote:
> Hi,
>
> I'm using embedded undertow with jastow for serving jsp pages.
> I registered custom error page for handling all 500 errors, but
> exception is not propagated to my custom 500.jsp page
> (javax.servlet.error.exception request attribute is never set).
> I debugged through undertow code and found that the problem is in
> "ServletInitialHandler", "handleFirstRequest" method. When a servlet
> throws exception, error page location is looked for only by exception
> type and not by exception code as well, so the exception is never
> propagated to my custom error page.
> Is this a bug or a feature? The only workaround I have found is to
> register my custom error page against JasperException.class, but I
> wouldn't want to do this for all the possible exceptions my application
> could throw.
>
> If it's a bug, than simple fix would be to look for error page by 500
> error code as well, like so:
>
> String location =
> servletContext.getDeployment().getErrorPages().getErrorLocation(t);
> if (location == null) {
>      location =
> servletContext.getDeployment().getErrorPages().getErrorLocation(500);
> }
>
> Regards,
> Dragan
>
> _______________________________________________
> undertow-dev mailing list
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev


More information about the undertow-dev mailing list