From 84b385385975fe2c532ee39fdd97a53c594c3cc2 Mon Sep 17 00:00:00 2001 From: Matt Farmer Date: Sun, 11 Jun 2017 17:35:32 -0400 Subject: [PATCH 1/2] Add special handling for UnavailableException This code adds special handling for javax.servelet.UnavailableException. This exception is an idiomatic way to signal a full abort to the Java Application server running the application. Please see #1843 for more information. --- .../liftweb/http/provider/HTTPProvider.scala | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/web/webkit/src/main/scala/net/liftweb/http/provider/HTTPProvider.scala b/web/webkit/src/main/scala/net/liftweb/http/provider/HTTPProvider.scala index abf75f7289..3def6eaa72 100644 --- a/web/webkit/src/main/scala/net/liftweb/http/provider/HTTPProvider.scala +++ b/web/webkit/src/main/scala/net/liftweb/http/provider/HTTPProvider.scala @@ -14,9 +14,9 @@ * limitations under the License. */ -package net.liftweb -package http -package provider +package net.liftweb +package http +package provider import net.liftweb.common._ import net.liftweb.util._ @@ -87,12 +87,29 @@ trait HTTPProvider { preBoot b.boot } catch { + // The UnavailableException is the idiomatic way to tell a Java application container that + // the boot process has gone horribly, horribly wrong. That _must_ bubble to the application + // container that is invoking the app. See https://github.com/lift/framework/issues/1843 + case unavailableException: javax.servlet.UnavailableException => + logger.error("------------------------------------------------------------------") + logger.error("------------------------------------------------------------------") + logger.error("------------------------------------------------------------------") + logger.error("------------------------------------------------------------------") + logger.error("********** Failed to Boot! An unavailable exception was thrown an all futher boot activities are aborted", unavailableException); + logger.error("------------------------------------------------------------------") + logger.error("------------------------------------------------------------------") + logger.error("------------------------------------------------------------------") + logger.error("------------------------------------------------------------------") + logger.error("------------------------------------------------------------------") + + throw unavailableException + case e: Exception => logger.error("------------------------------------------------------------------") logger.error("------------------------------------------------------------------") logger.error("------------------------------------------------------------------") logger.error("------------------------------------------------------------------") - logger.error("********** Failed to Boot! Your application may not run properly", e); + logger.error("********** Failed to Boot! Your application may not run properly", e); logger.error("------------------------------------------------------------------") logger.error("------------------------------------------------------------------") logger.error("------------------------------------------------------------------") From dd3362317f3bcef6074a7a5aee67108db3b2d218 Mon Sep 17 00:00:00 2001 From: Matt Farmer Date: Mon, 12 Jun 2017 10:52:58 -0400 Subject: [PATCH 2/2] Fix wording in UnavailableException error message --- .../src/main/scala/net/liftweb/http/provider/HTTPProvider.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/webkit/src/main/scala/net/liftweb/http/provider/HTTPProvider.scala b/web/webkit/src/main/scala/net/liftweb/http/provider/HTTPProvider.scala index 3def6eaa72..9d2beb7de1 100644 --- a/web/webkit/src/main/scala/net/liftweb/http/provider/HTTPProvider.scala +++ b/web/webkit/src/main/scala/net/liftweb/http/provider/HTTPProvider.scala @@ -95,7 +95,7 @@ trait HTTPProvider { logger.error("------------------------------------------------------------------") logger.error("------------------------------------------------------------------") logger.error("------------------------------------------------------------------") - logger.error("********** Failed to Boot! An unavailable exception was thrown an all futher boot activities are aborted", unavailableException); + logger.error("********** Failed to Boot! An UnavailableException was thrown and all futher boot activities are aborted", unavailableException); logger.error("------------------------------------------------------------------") logger.error("------------------------------------------------------------------") logger.error("------------------------------------------------------------------")