Page tree
Skip to end of metadata
Go to start of metadata

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.

Corrective Action:

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: 
  1. 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.
  2. 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/ 
  3. Copy the Error_Pages folder in the above mentioned path.  
  4. 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.
  • No labels


  1. Unknown User (104clvxii)

    Hi Santosh,

    I had gone through the posting.I am having the same issue.I tried to follow the steps what you had mentioned but i am not seeing <error-page > tag in our serve web.xml file. can you please help on this.



  2. Unknown User (107cvl9fc)

    Hi Santhosh,

    I do have same above issue (Nagesh reply). How  to  customize J2ee (webdynpro) run time error messages like  500, 404 etc...  in portal  7 ( not necessaly from /irj).

    Please  suggest.



  3. Former Member

    Hi Nagesh,

    Check in the appropriate deployment descriptor file. I guess the error code tags should be available, if not take a back up of the file & try adding the error code as mentioned in the post. Restart & check the same.



  4. Former Member

    As per ( Customizing default error messages for HTTP) Note Number: 795699

    If the error handling resource pointed by the location tag is dynamic (not a static html page but servlet or jsp page), then the actual type of the error can be determined by making use of preset by the webcontainer request attributes (for status code, exception type and so on). For more information see Servlet 2.3 specification - SRV 9.9 Error handling.
    It is advisory to use the <exception-type> error-handling mechanism rather than <error-code>.
    This is not only because it is Object Oriented but also because <error-code> only works if response.sendError() has been called explicitly.
    <error-code> does not work in the cases when response.setStatus() has been called because as defined in the servlet 2.3 specification (SRV 15.1.5 HttpServletResponse) setStatus should not be used when there is an error.
    There are however specific cases when the <exception-type> approach does not work. For example if the application uses sendError() method or the response code is set by the Container (401, 403, 404, etc), then <error-code> should be used in combination with <exception-type>.

    Also please refer to full note and also help link provided in it as below.\\

  5. Hi Santosh,

    Any idea how to achieve it for SAP NW 7.3 version? From which location can we get the  web.xml file  and in which location should we create the folder with custom error message?