java - Webapp startup fails but Jetty LifeCycle claims "started" -


i'm using embedded jetty launch standard java webapp. launcher this:

import org.eclipse.jetty.server.server; import org.eclipse.jetty.util.component.lifecycle.listener; import org.eclipse.jetty.webapp.webappcontext;  ...  listener listener = ...; server server = new server(8080); webappcontext webapp = new webappcontext(); ... webapp.addlifecyclelistener(listener);  server.sethandler(webapp); server.start(); ... 

this works fine in can start app , browse , appears working.

but i'm trying add error reporting launcher. i've temporarily set webapp throw exception in contextinitialized() method of servletcontextlistener. exception thrown, , log message of

error org.eclipse.jetty.util.log failed startup of context webappcontext@... 

but lifecyclelistener not receieve failure event. in fact, receives started event, , webaddcontext passed listener returns false lifecycle#isfailed() , true lifecycle#isrunning().

browsing webapp results in 503 service unavailable errors.

this happens in jetty versions 7.0.1.v20091125 , 7.2.1.v20101111. see jetty 7 api docs.

as per comments heri's answer, webappcontext swallows exceptions. otherwise caught abstractlifecycle , failure events sent out. gets me of way there:

public class throwywebappcontext extends webappcontext {     @override     protected void dostart() throws exception {         super.dostart();         if (getunavailableexception() != null) {             throw (exception) getunavailableexception();         }     } } 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -