Error handling in the messaging system composition service

When an error occurs in the processing of a JavaServer page, the result of the page typically contains extensive information generated when the system is running. If this is not the desired result on a JavaServer page failure, there are two potential approaches to make the behavior more predictable.

In the first approach, we can specify an error page in your JavaServer page, which runs if an unanticipated error is encountered, such as an uncaught exception. To use this approach, you need to include the following line in your main page:

You also need to include the following line in YourError.jsp:

Note: In the event of an error, the result of the message composition is the result of YourError.jsp. For more details please see the JSP 1.0 specification.

In the second approach, instead of having the error message processed as an outbound message, we can use an error JavaServer page that generates output that is processed as an exception. To do this, use the ComposerError.jsp as the basis for handling the error. Do this the same way as described above, but the beginning of YourError.jsp should start with the first two lines of ComposerError.jsp. This allows the composition runtime to detect that an error occurred, and to raise an exception. The ComposerError.jsp can be found in the following directory:

The first two lines of the ComposerError.jsp are as follows:

To use this file, we can indicate that it is the error page by setting errorPage="ComposerError.jsp" in the main JSP page. If we want extra information, we can copy this file to another filename, such as YourError.jsp, and place the extra error information after these two lines in the new file. You would then set errorPage="YourError.jsp" in the main JSP page. Any extra output specified after these two first lines will be part of the text of the exception thrown by the composition service.


Related concepts
Outbound messaging system