// the DefaultErrorHandlerServlet as an ad-hoc fallback
if (fallbackErrorServlet == null) {
// fall back to an adhoc instance of the DefaultErrorHandlerServlet
// if the actual service is not registered (yet ?)
try {
final Servlet defaultServlet = new DefaultErrorHandlerServlet();
defaultServlet.init(new SlingServletConfig(servletContext,
null, "Sling (Ad Hoc) Default Error Handler Servlet"));
fallbackErrorServlet = defaultServlet;
} catch (ServletException se) {
LOGGER.error("Failed to initialize error servlet", se);
}