users@glassfish.java.net

Re: How to stop application deployment after failed initialization

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Fri, 08 May 2009 11:57:07 -0700

On 05/ 8/09 11:31 AM, glassfish_at_javadesktop.org wrote:
> Thanks for this hint.
>
> I will implement and test, whether throwing an instance of 'java.lang.RuntimeException' will prematurely terminate the deployment process.
>
> As we can see here once more: The disadvantage of using undeclared (i.e. runtime) exceptions is, that the behaviour is hidden. Hidden is all-right if something happens unexpectedly and unforeseen, but initilization failures are not that unusual ...
>

I completely agree.
Unfortunately, the ServletContextListener (and other listener) interfaces
have been around since the early Servlet spec days, and adding a throws
clause with a
checked Exception to their methods would break backward compatibility.

Jan