I am implementing a 3rd party J2EE application with Websphere as Application Server. I have the following code in one of the JSPs (callingPage)
try {
RequestDispatcher dispatcher = request.getRequestDispatcher(includePage);
dispatcher.include(request,response);
} catch (Exception Ex) {
// process the excpetion
// and create appropriate response object with body as XML string
}
The includePage is also a JSP page and the response is expected to have XML body when no exceptions. In a specific scenario, the includePage is throwing a valid (custom) excption. But the control does not go to catch block in callingPage.
On inspecting the response, I found that the response body contains a string <HTTP ResponseCode><CustomExceptionType><CustomException.getMessage()> with response code as 500. Since the response body is not an XML string, we get parse exception downstream.
I checked applications web.xml and there is no custom error page specified for code 500. I discussed with the Websphere admin and he could not be of much help (he claims he has not done anything specific with instance). The support team of application vendor tested it out in their Websphere instance and confirm that it works. According to them it should be a Websphere configuration.
My knowledge of J2EE framework or Websphere is limited. I tried to search through existing queries but could not figure out the possible cause.
The issue was resolved by setting a custom property for Websphere web container com.ibm.ws.webcontainer.dispatcherRethrowSER. The details are here http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Frweb_custom_props.html