"java.lang.NoClassDefFoundError: org/apache/log4j/Level" occurs when starting the adapter

"java.lang.NoClassDefFoundError: org/apache/log4j/Level" occurs when starting the adapter

book

Article ID: KB0070297

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for Database 7.3.x

Description

The following error may occur when starting the adapter:
==============================================
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/tibco/tpcl/5.12/lib/slf4j-log4j12-1.7.31.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/tibco/tpcl/5.12/lib/log4j-slf4j-impl-2.17.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/tibco/tpcl/5.12/lib/slf4j-simple-1.7.31.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Failed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: org/apache/log4j/Level
==============================================

Environment

Product: TIBCO ActiveMatrix BusinessWorks Plug-in for Database Version: 7.3.x OS: All Supported Operating Systems

Resolution

The above issue occurs if "slf4j-log4j12-1.7.31.jar" is loaded before slf4j-simple-1.7.31.jar or log4j-slf4j-impl-2.17.1.jar.
When the adapter starts, it loads the log4j jar files from TPCL_HOME/lib. The OS determines the order in which the jar files are loaded. Sometimes, the "slf4j-log4j12-1.7.31.jar" is loaded first, and this causes the above problem.

To resolve this problem, add "%TPCL_HOME%/lib/slf4j-simple-1.7.31.jar" to the beginning of tibco.class.path.extended in the adapter tra file to ensure that the adapter loads slf4j-simple-1.7.31.jar first.

Issue/Introduction

"java.lang.NoClassDefFoundError: org/apache/log4j/Level" occurs when starting the adapter