PasswordEncryption.bat throws error "NoClassDefFoundError log4j.LogManager"
search cancel

PasswordEncryption.bat throws error "NoClassDefFoundError log4j.LogManager"

book

Article ID: 245251

calendar_today

Updated On:

Products

CA Process Automation Base

Issue/Introduction

After applying CP06 patch on top of 4.3.05 version, PasswordEncryption.bat file throws below error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager
        at com.optinuity.c2o.util.BaseLogger.getInstance(BaseLogger.java:36)
        at com.optinuity.c2o.util.PasswordEncryption.<clinit>(PasswordEncryption.java:18)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.LogManager
        at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        ... 2 more

Environment

Release : 4.3.05 CP06

Component : Process Automation

Cause

The PasswordEncryption.bat file uses log4j-1.x jar file from path: ".c2orepository/.c2ocommonresources/lib/log4j/jars/"
In CP06 patch, log4j component is upgraded to version 2.17.1 from 1.2.15 and PasswordEncryption.bat file was not updated with the new jar filename.

Resolution

1. Open the PasswordEncryption.bat file in notepad++
 
2. Check the line 15 (starts with %JAVA_HOME%) for "log4j-1.2.15.jar" entry, it looks like:
    ".c2orepository/.c2ocommonresources/lib/log4j/jars/log4j-1.2.15.jar"

3. The CP06 environment contains below files under: <PAM installation location>/server/c2o/.c2orepository/.c2ocommonresources/lib/log4j/jars/
     a. log4j-1.2-api-2.17.1.jar
     b. log4j-api-2.17.1.jar
     c. log4j-core-2.17.1.jar
  
4. You need to update the PasswordEncryption.bat file to reflect the above 3 jar filenames as:
.c2orepository/.c2ocommonresources/lib/log4j/jars/log4j-1.2-api-2.17.1.jar;.c2orepository/.c2ocommonresources/lib/log4j/jars/log4j-api-2.17.1.jar;.c2orepository/.c2ocommonresources/lib/log4j/jars/log4j-core-2.17.1.jar;

5. Save the file and test the PasswordEncryption.bat again.