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)
This commit is contained in:
Simon Oberhammer 2012-03-20 10:26:19 +01:00
parent bb8aba7adc
commit 786a5e86bd

View file

@ -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);