如何在服务器静音时替换Jetty的默认错误页面

时间:2012-12-12 06:56:43

标签: error-handling jetty

我正在尝试处理我的服务器静音且用户尝试访问它的用例。 今天,当服务器静音时,用户获得503的码头默认错误页面(HTTP ERROR:503)。 我想用自定义错误页面替换此错误页面。 我的web.xml上有自定义页面,但没有加载(因为服务器已静音)。 我尝试编写自己的错误处理程序,扩展ErrorPageErrorHandler,并在jetty-web.xml上注册它 O debug我看到我的类已加载,但是当错误发生时它不会激活。

我通过停止我的数据库服务来静音服务器。这似乎导致ContextLoader失败。这是一个部分堆栈跟踪,任何见解都会有所帮助:

at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:643)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:233)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1213)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:589)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:454)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:89)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:89)
at org.eclipse.jetty.server.Server.doStart(Server.java:261)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at com.hp.qc.JettyRunner.startJetty(JettyRunner.java:73)
at com.hp.qc.JettyRunner.main(JettyRunner.java:31)

0 个答案:

没有答案
相关问题