From 892078eb4ef74d464dcc4c78d2a503857ceeb66b Mon Sep 17 00:00:00 2001 From: Simon Oberhammer Date: Tue, 20 Mar 2012 10:26:19 +0100 Subject: [PATCH] to fix the illegal state exception i switched the order of app-binding and jetty-server-starting; now it gets a bit farther but throws another exception: 2012-03-20 10:25:35.550:WARN:oejuc.AbstractLifeCycle:FAILED org.eclipse.jetty.servlet.ServletHandler@177f409c: java.lang.ClassCastException: org.eclipse.jetty.server.handler.ContextHandler cannot be cast to org.eclipse.jetty.servlet.ServletContextHandler java.lang.ClassCastException: org.eclipse.jetty.server.handler.ContextHandler cannot be cast to org.eclipse.jetty.servlet.ServletContextHandler at org.eclipse.jetty.servlet.ServletHandler.doStart(ServletHandler.java:147) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90) at org.eclipse.jetty.server.handler.ScopedHandler.doStart(ScopedHandler.java:97) at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:722) at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:676) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) at helma.main.ApplicationManager$AppDescriptor.bind(ApplicationManager.java:550) at helma.main.ApplicationManager.startAll(ApplicationManager.java:168) at helma.main.Server.run(Server.java:602) at java.lang.Thread.run(Thread.java:662) --- src/helma/main/Server.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/helma/main/Server.java b/src/helma/main/Server.java index e9ed7309..70042696 100644 --- a/src/helma/main/Server.java +++ b/src/helma/main/Server.java @@ -78,7 +78,7 @@ public class Server implements Runnable { // the XML-RPC server protected WebServer xmlrpc; - + Thread shutdownhook; @@ -512,18 +512,18 @@ public class Server implements Runnable { // exception in xmlrpc server shutdown, ignore. } } - + if (helmaLogging) { Logging.shutdown(); } - + server = null; - + try { Runtime.getRuntime().removeShutdownHook(shutdownhook); // HACK: running the shutdownhook seems to be necessary in order - // to prevent it from blocking garbage collection of helma - // classes/classloaders. Since we already set server to null it + // to prevent it from blocking garbage collection of helma + // classes/classloaders. Since we already set server to null it // won't do anything anyhow. shutdownhook.start(); shutdownhook = null; @@ -598,6 +598,9 @@ public class Server implements Runnable { logger.error("Error setting security manager", x); } + // start applications + appManager.startAll(); + // start embedded web server if (jetty != null) { try { @@ -607,9 +610,6 @@ public class Server implements Runnable { } } - // start applications - appManager.startAll(); - while (Thread.currentThread() == mainThread) { try { Thread.sleep(3000L);