I am writing a module to verify product license of a web application. The scenario is simple. License information will be verified in ServletContextListener:contextInitialized(). If the information isn't correct then RuntimeException will be thrown right away.
My module works fine on Glassfish and Sun Java System Web Server but it doesn't work like what I've expected when the application has been deployed on WebSphere.
On WebSphere, the exception has been logged in log file but it doesn't seem to make the application unavailable to clients.
"Some exceptions do not occur under the call stack of another component in the application. An example of this is a … ServletContextListener that throws an unhandled exception during a notification of servlet context initialization…. In this case, the Developer has no opportunity to handle the exception. *The container may respond to all subsequent requests to the Web application with an HTTP status code 500 to indicate an application error"
Does WebSphere choose not to do as the spec suggest(since it's "may" not "must")?
I am not sure this has something to do with this defect or not.
"Each listener's contextInitialized and contextDestroyed calls
are wrapped in their own try/catch block"
It seem like RuntimeException will not stop initialization process right away. If this is true then how can I mark the application "unavailable" on websphere?
Thanks in advance, any response would be appreciated.
subject: How WebSphere react to RuntimeException in ServletContextListener