码头:检测Webapp是否无法启动 [英] Jetty: Detect if Webapp failed to start

查看:151
本文介绍了码头:检测Webapp是否无法启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在启动一个包含单个web应用程序的嵌入式Jetty实例. Webapp在启动时启动. 我想知道如何检测Webapp的contextInitialized是否引发异常.

I am launching an embedded Jetty instance containing a single webapp. The webapp launches on start-up. I'd like to know how to detect if the Webapp's contextInitialized throws an exception.

当网络应用引发异常时, Server.start()不会,server.isRunning()返回true.有没有办法让我从容器外部侦听webapp异常?

When the webapp throws an exception, Server.start() doesn't and server.isRunning() returns true. Is there a way for me to listen for webapp exceptions from outside the container?

推荐答案

回答我自己的问题.

设置WebAppContext.setThrowUnavailableOnStartupException(true)会导致服务器将所有Webapp异常传播到Server.start().我猜想在服务器启动后也可以调用WebAppContext.isFailed()来检查各个上下文.

Setting WebAppContext.setThrowUnavailableOnStartupException(true) causes the server to propagate any webapp exceptions to Server.start(). I'm guessing one could also invoke WebAppContext.isFailed() after server start-up to check individual contexts.

这篇关于码头:检测Webapp是否无法启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆