Training

WASKB007 - Reporting System Errors from a WebSphere Application Tutorial

Popular Courses

Browse Our Free Resources

  • whitepapers
  • whitepapers
  • webinars
  • blogs

Our Locations

Training Centres

Vancouver, BC
Calgary, AB
Edmonton, AB
Toronto, ON
Ottawa, ON
Montreal, QC
Hunt Valley
Columbia

locations map

Calgary

550 6th Av SW
Suite 475
Calgary, AB
T2P 0S2

Toronto

821A Bloor Street West
Toronto, ON
M6G 1M1

Vancouver

409 Granville St
Suite 902
Vancouver, BC
V6C 1T2

U.S. Office

436 York Road
Suite 1
Jenkintown, PA
19046

Other Locations

Dallas, TX
Miami, FL

Introduction

System errors are unexpected and usually cause unrecoverable damage to a transaction. Examples of system error are: file system out of space, out of memory exception and database connection timeout.

Basic Guidelines

Follow a simple set of guidelines to report system error.

  1. Avoid complicated logic in the error display page. You want to make sure that the error pages have a very high probability of functioning when drastic errors are occuring elsewhere in the system. In most cases, static HTML error pages are preferred.
  2. Provide a phone number or e-mail in the error page for the user to contact the web master and report the problem.
  3. Do not display details such as stack trace in the error page. Use Log4J or a similar system to store the error details in a log file.

J2EE and WebSphere

J2EE lets us specify a URI (for HTML, JSP or Servlet) for an HTTP error code in the web.xml file. This helps us report problems such as 404 file not found and 401 authorization failed. Imprtant: If you are associating a URI for the 401 error code, make sure that the URI is unprotected.

WebSphere extension allows us to specify a catch all URI that is invoked when the web container catches an exception thrown from a Servlet or JSP.

Developing System Error Pages

WebSphere Studio Application Developer (WSAD) makes it easy to develop error pages and configure the web deployment descriptor.

Open the deployment descriptor by double clicking on the web.xml file. Click on the Pages tab. In the Error Pages section click on Add. Enter an HTTP error code and URI or select them from a list.

To specify the catch all error page, click on the Extensions tab. In the Default error page field, enter the JSP or HTML file name or click on Browse to pick the file name from a list.

Save the deployment descriptor settings.

Test

Create two sets of error conditions:

  1. HTTP error condition such as 404 file not found and 401 authorization failed. Make sure that the designated error reporting pages are getting displayed.
  2. Application code error condition such as unhandled exception thrown froma JSP, ServletException from a Servlet and JSP compilation problem. Make sure that the catch all error page is getting displayed. Detail error message will be logged in the standard output file of the application server (or, console in case of WSAD).

Conclusion

System error pages are important customer service tools. You want to make sure that they are available under all conditions and contain useful information. This article shows you how to report system errors in a reliable fashion by leveraging the J2EE standard and WebSphere extensions.


Feedback

Feedback


Email Address: *


Very useful Somewhat useful Not bad Needs many corrections


Comments:
*


( * ) = mandatory field