Customizing Error Messages of Portal applications
Author: Santhosh Raj
Submitted: 23 October 2008
In Portal implementations, many of us might have come across requirements pertaining to Usability and Aesthetics. For me, one among such requirements was to display custom error messages which are user friendly instead of the standard error messages with SAP J2EE specific exceptions.
During the compliance check in the final preparation stage of the implementations, the below are the few points which normally clients highlighted.
Compliance Issue: Observed parameter:
It was observed that the Portal application has responded with error message, indicating an undefined state that may expose sensitive information. The above statement refers to the Exceptions displayed in Portal.
User friendly message to be displayed for error codes 404, 403, 500 or any other Java specific errors.
There is a standard procedure for capturing error codes and displaying custom error messages using KM. Details on the same can be found in the below link.
But this doesn't help in capturing all the exceptions. The following approach can be used for customizing the error messages of all the Portal applications deployed in the server. The below steps refer to the configurations for URI starting from irj.
Procedure for customizing Error messages for Applications starting from /irj:
- Create custom error pages (HTML/JSP) as per the company branding standards for error codes 403, 404, 500, etc or for any Java exceptions and place it inside a folder, say Error_Pages.
- Log in to Portal Server through FTP/Telnet access as an administrator. In the physical folders browse and navigate into the apps folder. The path for the same is given below. ftp://<FQDN>/usr/sap/<SystemID>/<InstanceID>/j2ee/cluster/<ServerNode>/apps/sap.com/irj/servlet_jsp/irj/root/
- Copy the Error_Pages folder in the above mentioned path.
- Navigate to WEB-INF folder and edit the <error-page> tag occurrences of web.xml file as given below:
5. Save the file. The changes will reflect after restarting the server.
Result: Example for Error Code 404
- In case if you want to change the error messages for a specific application, then copy the Error_Pages folder inside /servlet_jsp of the application component folder as the deployment descriptor file, web.xml is specific to an application.
- The procedure is required to be repeated in case of multiple clusters in the Portal Server.