Search code examples
javawebspherestack-tracecustom-error-pages

How to set server level custom error text in Websphere application server


There is currently a requirement for us to edit the text delivered error messages that the IBM Websphere throws when it could not access the application, we limited the IP addresses which can access the application. in case of invalid IP address, Websphere looks for a custom error page which we added in our application but it can't access them so it throws

SRVE0260E: The server cannot use the error page specified for your application to handle the Original Exception printed below

also with 500 java.lang.RuntimeException: invalid host header and 404 SRVE0295E: Error reported: 404

I already tried Webcontainer custom property com.ibm.ws.webcontainer.displayTextWhenNoErrorPageDefined which allows the display of the custom text when there is no error page defined at the application level, but it doesn't work. and there is com.ibm.ws.webcontainer.suppressHtmlRecursiveErrorOutput which prevent printing stacktrace, but it's not a solution for me.

I just need to make these errors more human readable with just a simple text. and it needs to be done only in Websphere and not in the application code.


Solution

  • I opened a service request with IBM for this exact issue. I asked them if there is a way to customize the response for SRVE0260E. (that is, something similar to custom property com.ibm.ws.webcontainer.webgroupvhostnotfound for SRVE0017W)

    IBM's response was, "I have discussed your concern with our SME, we don't have any property like that for SRVE0260E."

    So, it appears the best we can do at the moment is suppress the stack trace with com.ibm.ws.webcontainer.suppressHtmlRecursiveErrorOutput.