ctx.addServletMapping("/error", "errorPage");
// And the handling for 404 responses
ErrorPage errorPage = new ErrorPage();
errorPage.setErrorCode(Response.SC_NOT_FOUND);
errorPage.setLocation("/error");
ctx.addErrorPage(errorPage);
// Add the request listener
Bug51653RequestListener reqListener =
new Bug51653RequestListener(trace);
((StandardContext) ctx).addApplicationEventListener(reqListener);