Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
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.

http://help.sap.com/saphelp_nw70/helpdata/EN/47/1d5a4390524403e10000000a1553f6/frameset.htm

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/sap.com/irj/servlet_jsp/irj/root/ 
  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 

Before

After

Note:

  • 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

5 Comments

  1. Guest

    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.

    Regards,

    Nagesh

  2. Guest

    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.

    Thanks

    Aravind


  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.

    Regards,

    Santhosh

  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.

    http://help.sap.com/saphelp_nw04/helpdata/en/9a/e74d426332bd30e10000000a155106/frameset.htm\\

  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?

    Regards,

    Navya.