How to resolve java.lang.NoSuchMethodError: org.apache.log4j.spi.LoggingEvent.getLogger()Lorg/apache/log4j/Category

How to resolve java.lang.NoSuchMethodError: org.apache.log4j.spi.LoggingEvent.getLogger()Lorg/apache/log4j/Category

book

Article ID: KB0086137

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition -
Not Applicable -

Description

Description:
When starting BE Engine , the following exception is thrown:

WRAPPER - start method threw an exception
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.log4j.spi.LoggingEvent.getLogger()Lorg/apache/log4j/Category;
        at com.tibco.cep.runtime.service.logging.TraceMessageLayout.format(TraceMessageLayout.java:63)
        at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301)
        at org.apache.log4j.WriterAppender.append(WriterAppender.java:159)
        at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
        at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
        at org.apache.log4j.Category.callAppenders(Category.java:203)
        at org.apache.log4j.Category.forcedLog(Category.java:388)
        at org.apache.log4j.Category.log(Category.java:823)
        at com.tibco.cep.runtime.service.logging.impl.LoggerImpl.log(LoggerImpl.java:93)
        at com.tibco.cep.container.standalone.BEMain.main(SourceFile:74)

Symptoms:
The class path is incorrect and the log4j jars has a wrong reference with other TIBCO products (BW and Hawk) or has different jar files loaded in a different order.
Cause:
Try starting the BE engine in command line mode with debug enabled.The '--debug' added to the command line executing is to see what classes are being loaded.
Example:

cd $BE_HOME\examples\standard\FraudDetection
$BE_HOME\bin\be-engine --propFile $BE_HOME\bin\be-engine.tra --debug -u default -c FraudDetection\fd.cdd fd.ear >FDEngineDebug.log

Issue/Introduction

How to resolve java.lang.NoSuchMethodError: org.apache.log4j.spi.LoggingEvent.getLogger()Lorg/apache/log4j/Category

Resolution

Make the correct reference of log4j jars in the BE engine TRA file.

Add the property “%PSP%%BE_HOME%/lib/ext/tpcl/apache%PSP%” to front of tibco.env.STD_EXT_CP ( TIBCO standard classpath) to reference the correct log4j jars.
tibco.env.STD_EXT_CP =%PSP%%BE_HOME%/lib/ext/tpcl/apache%PSP% (followed by other properties)