IBM Support

Custom code and JSP helpers may fail after upgrading to OpenPages 8.2.0.4 or later

Troubleshooting


Problem

Custom Java code and custom JSP helpers from releases before to OpenPages 8.2.0.4 might fail to run after upgrading to OpenPages 8.2.0.4 or later. This can occur due to the upgrade of the logging component from log4j version 1.2.17 to log4j2 version 2.14.1.
To mitigate the risk, the OpenPages 8.2.0.4 installer and later includes the Apache log4j 1.x bridge in the aurora/op-ext-lib folder, which can allow code that uses the old log4j libraries to continue functioning until such a time that you can remediate the code to use the new log4j2 APIs.  However, there are still use cases that might fail due to:

Symptom

  • Running a helper results in the following error message:
    An error occurred processing your request. Please contact your System Administrator.
  • Running custom Java code may fail due to the documented limitations of the log4j 1.x bridge

Cause

The definition of the Logger class in the new version of Log4j changed from the older version.  In the older version used before OpenPages 8.2.0.4, the class was defined as: org.apache.log4j.Logger.  In the new version of log4j, this changed to: org.apache.logging.log4j.Logger.
Therefore, any custom code that requests a logger through the following OpenPages SDK APIs, and assigns it to a variable of type org.apache.log4j.Logger, will result in runtime exceptions and will need to be remediated:
com.openpages.ext.solutions.common.LoggerUtil.getLogger()
com.openpages.ext.solutions.common.LoggerUtilExtended.getLogger()
com.openpages.aurora.common.logging.LoggerFactory

Diagnosing The Problem

To diagnose the issue with JSP helpers, do the following steps for each server in your test environment:
  1. Locate the web.xml file under publishweb.war/WEB-INF.
    For installations that are on-prem, this file is located at ${OP_HOME}/wlp-usr/shared/apps/op-apps.ear/publishweb.war/WEB-INF/web.xml. 
    For CP4D, this file is located at /opt/ibm/wlp/usr/servers/defaultServer/apps/expanded/op-apps.ear/publishweb.war/WEB-INF/web.xml
  2. Backup the file to a new file called web.xml.org
  3. Edit the web.xml file, remove the following entry from it and save it:
        <error-page>
            <error-code>500</error-code>
            <location>/misc/HTTP500Error.jsp</location>
        </error-page>
  4. Restart the OpenPages application server
Once all the servers have been restarted, then
  1. Login to OpenPages
  2. Run the failed helper
    The result of running the failed helper will generate an error such as the following:
     
    HTTP Error Code:   500
     
    Error Message:
    JSPG0049E: /Reports/SOX/ORM Custom Reports/Custom.jsp failed to compile : 
    JSPG0091E: An error occurred at line: 61 in the file: /Reports/SOX/ORM Custom Reports/Custom.jsp
    JSPG0093E: Generated servlet error from file: /Reports/SOX/ORM Custom Reports/Custom.jsp 
    /home/opuser/OP/OpenPages/wlp-usr/servers/opapp-OPNode1Server1/workarea/org.eclipse.osgi/73/data/temp/default_node/SMF_WebContainer/op-apps/publishweb/Reports/SOX/ORM Custom Reports/_Custom.java:164: error: incompatible types: org.apache.logging.log4j.core.Logger cannot be converted to org.apache.log4j.Logger
          		logger = LoggerUtil.getLogger();
Once the issue has been diagnosed, please repeat the following steps for all servers in your test environment:
  1. Restore the contents of web.xml to its initial state by copying web.xml.org to web.xml
  2. Delete the web.xml.org file
  3. Restart the OpenPages application server.

Resolving The Problem

To remediate JSP helpers that fail as above:
  1. Download the helper code through the OpenPages UI and open it for editing (or, if it is maintained in a source code control system, edit it there)
  2. Look for the import statement org.apache.log4j.Logger, and change it to org.apache.logging.log4j.Logger. For example,
    Change from:
    <%@ page import="org.apache.log4j.Logger" %>
    to:
    <%@page import="org.apache.logging.log4j.Logger"%>
  3. Save the file and upload it to OpenPages
To remediate custom Java code that fails due to the new Log4j2 library, refer to the Apache Log4j2 documentation referenced here.

Related Information

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB10","label":"Data and AI"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSFUEU","label":"IBM OpenPages with Watson"},"ARM Category":[{"code":"a8m50000000ClALAA0","label":"Administration and Configuration"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]

Document Information

Modified date:
18 November 2021

UID

ibm16513713