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.
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?
Answering my own question.
Setting
WebAppContext.setThrowUnavailableOnStartupException(true)causes the server to propagate any webapp exceptions toServer.start(). I’m guessing one could also invokeWebAppContext.isFailed()after server start-up to check individual contexts.