File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Websphere and the fly likes 	 How WebSphere react to RuntimeException in ServletContextListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "	 How WebSphere react to RuntimeException in ServletContextListener" Watch "	 How WebSphere react to RuntimeException in ServletContextListener" New topic
Author

How WebSphere react to RuntimeException in ServletContextListener

chatchai chailuecha
Greenhorn

Joined: Dec 14, 2006
Posts: 18
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.

I have googled a bit and found this link quite interesting; Abort java webapp on startup

Servlet Specification
"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.

www.devguli.com


 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How WebSphere react to RuntimeException in ServletContextListener
 
Similar Threads
WAS Websphere abort application startup / deployment
Is it guaranteed that web server will initialize all web application on the server startup time
Multiple form-beans aren't recognized
Get rid of line numbers
According to TLD or attribute directive in tag file, attribute items does not accept any expressions