@Override public Throwable getUnavailableException() { return webAppContext.getUnavailableException(); }
@Override public boolean hasStarted() { return !webAppContext.isFailed() && webAppContext.getUnavailableException() == null; }
Throwable unavailableException = webAppContext.getUnavailableException(); if (unavailableException != null) {
Throwable unavailableException = webAppContext.getUnavailableException(); if (unavailableException != null) {
final Throwable t = webAppContext.getUnavailableException(); if (t != null) { logger.error("Unable to start context due to " + t.getMessage(), t);
if (context.getUnavailableException() != null) { startUpFailure(context.getUnavailableException());
protected static void contextStartupFailed(WebAppContext pContext) throws Exception { Throwable failedException = pContext.getUnavailableException(); if (failedException != null) { throw new RuntimeException("Error starting WebContext of Jetty.", failedException); }
public void start() { try { // start the server server.start(); // ensure everything started successfully for (Handler handler : server.getChildHandlers()) { // see if the handler is a web app if (handler instanceof WebAppContext) { WebAppContext context = (WebAppContext) handler; // see if this webapp had any exceptions that would // cause it to be unavailable if (context.getUnavailableException() != null) { startUpFailure(context.getUnavailableException()); } } } dumpUrls(); } catch (final Throwable t) { startUpFailure(t); } }
Throwable unavailableException = webAppContext.getUnavailableException(); if (unavailableException != null) {
protected void start() { try { logger.info("Starting WebApp server"); createServer(); createConnector(); createContext(); wrapHandlers(); server.start(); // Handler/context startup errors aren't propagated, we have to do it manually. Throwable error = context.getUnavailableException(); if (error != null) { logger.error("Jetty context startup failed", error); throw new RuntimeException("WebApp context startup is unavailable", error); } if (context.isFailed()) throw new RuntimeException("WebApp context startup failed"); logger.info("WebApp server started"); } catch (Exception e) { throw new RuntimeException("WebApp server failed", e); } }
protected void start() { try { log.info("Starting WebApp server"); createServer(); createConnector(); createContext(); wrapHandlers(); server.start(); // Handler/context startup errors aren't propagated, we have to do it manually. Throwable error = context.getUnavailableException(); if (error != null) { log.error("Jetty context startup failed", error); throw new RuntimeException("WebApp context startup is unavailable", error); } if (context.isFailed()) throw new RuntimeException("WebApp context startup failed"); log.info("WebApp server started"); } catch (Exception e) { throw new RuntimeException("WebApp server failed", e); } }
Throwable unavailableException = webAppContext.getUnavailableException(); if (unavailableException != null) {
if (context.getUnavailableException() != null) { System.err.println("Failed to start web server: " + context.getUnavailableException().getMessage()); System.err.println("Shutting down..."); logger.warn("Failed to start web server... shutting down.", context.getUnavailableException()); server.stop(); System.exit(1);
if (context.getUnavailableException() != null) { System.err.println("Failed to start web server: " + context.getUnavailableException().getMessage()); System.err.println("Shutting down..."); logger.warn("Failed to start web server... shutting down.", context.getUnavailableException()); server.stop(); System.exit(1);
if (webAppContext.getUnavailableException() != null) { throw new IllegalStateException( "Web App in Jetty Server does not seem to have started up; CHECK THE LOG! PS: Chained exception is: ", webAppContext.getUnavailableException()); } else { throw new IllegalStateException(
@Test public void startServer() throws Throwable { Server server = new org.eclipse.jetty.server.Server(Integer.parseInt(PORT)); WebAppContext webappcontext = new WebAppContext(); webappcontext.setContextPath("/resolver"); webappcontext.setBaseResource(Resource.newClassPathResource("/resolver")); HandlerCollection handlers = new HandlerCollection(); handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()}); server.setHandler(handlers); server.start(); Throwable e = webappcontext.getUnavailableException(); if (e != null) { throw e; } server.stop(); }
private synchronized void internalActivateArchive( Topology topology, File warDir ) throws IOException, ZipException, ParserConfigurationException, TransformerException, SAXException { log.activatingTopologyArchive( topology.getName(), warDir.getName() ); try { WebAppContext newContext = createWebAppContext( topology, warDir, Urls.decode( warDir.getName() ) ); WebAppContext oldContext = deployments.get( newContext.getContextPath() ); deployments.put( newContext.getContextPath(), newContext ); if( oldContext != null ) { contexts.removeHandler( oldContext ); } contexts.addHandler( newContext ); if( contexts.isRunning() && !newContext.isRunning() ) { newContext.start(); if(!newContext.isAvailable()) { throw newContext.getUnavailableException(); } } } catch( Throwable e ) { auditor.audit( Action.DEPLOY, topology.getName(), ResourceType.TOPOLOGY, ActionOutcome.FAILURE ); log.failedToDeployTopology( topology.getName(), e ); } }
private synchronized void internalActivateArchive( Topology topology, File warDir ) { log.activatingTopologyArchive( topology.getName(), warDir.getName() ); try { WebAppContext newContext = createWebAppContext( topology, warDir, Urls.decode( warDir.getName() ) ); WebAppContext oldContext = deployments.get( newContext.getContextPath() ); deployments.put( newContext.getContextPath(), newContext ); if( oldContext != null ) { contexts.removeHandler( oldContext ); } contexts.addHandler( newContext ); if( contexts.isRunning() && !newContext.isRunning() ) { newContext.start(); if(!newContext.isAvailable()) { throw newContext.getUnavailableException(); } } } catch( Throwable e ) { auditor.audit( Action.DEPLOY, topology.getName(), ResourceType.TOPOLOGY, ActionOutcome.FAILURE ); log.failedToDeployTopology( topology.getName(), e ); } }