How to resolve the exception "java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger" that occurs when using HTTP.sendRequest() in TIBCO BusinessEvents.

How to resolve the exception "java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger" that occurs when using HTTP.sendRequest() in TIBCO BusinessEvents.

book

Article ID: KB0093459

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition -
Not Applicable -

Description

Description:
The exception is caused because two different versions of slf4j-jar files are being loaded during the TIBCO BusinessEvents engine start up. The TIBCO BusinessEvents code does not call slf4j directly, rather it is called indirectly from third party libraries such as Apache HTTP client libraries, tibcrypt.

Common location of slf4j JAR files :

1.slf4j-api-1.7.5.jar and slf4j-log4j12-1.7.5.jar from BE_HOME/lib/ext/tpcl
2.slf4j-api-1.5.2.jar and slf4j-log4j12-1.5.2.jar from HAWK_HOME/lib           

Here is the complete error stack of the message received when you hit the slf4j version mis-match issue:

java.util.concurrent.ExecutionException: java.lang.Exception: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at com.tibco.cep.driver.http.client.impl.httpcomponents.JobProcessor.perform(SourceFile:68)
    at com.tibco.cep.driver.http.client.impl.httpcomponents.HttpComponentsClient.executeSync(SourceFile:307)
    at com.tibco.cep.driver.http.HttpDestination.a(SourceFile:144)
    at com.tibco.cep.driver.http.HttpDestination.sendSyncMessage(SourceFile:125)
    at com.tibco.cep.driver.http.client.impl.httpcomponents.HttpComponentsClientService.sendRequest(SourceFile:162)
    at com.tibco.cep.driver.http.client.impl.httpcomponents.HttpComponentsClientService.sendRequest(SourceFile:115)
    at com.tibco.be.functions.channel.http.HTTPChannelFunctions.sendRequest(SourceFile:317)
    at be.gen.RuleFunctions.$9y002fConcepts$9y002fApiResponseCallValidationApi$9y002fEvents$9y002fPatientWeight$.CallValidationApi($9y002fConcepts$9y002fApiResponseCallValidationApi$9y002fEvents$9y002fPatientWeight$.java:16)
    at be.gen.Rules.ValidateWeight$ValidateWeight_a.execute(ValidateWeight.java:33)
    at com.tibco.cep.kernel.core.rete.ReteWM.resolveConflict(SourceFile:322)
    at com.tibco.cep.kernel.core.rete.ReteWM.void(SourceFile:298)
    at com.tibco.cep.kernel.core.rete.ReteWM.assertObject(SourceFile:1645)
    at com.tibco.cep.runtime.session.impl.RuleSessionImpl.assertObject(RuleSessionImpl.java:1414)
    at com.tibco.cep.runtime.scheduler.impl.WorkerBasedControllerV2$2.doTxnWork(WorkerBasedControllerV2.java:431)
    at com.tibco.cep.kernel.core.rete.BeTransaction.run(SourceFile:156)
    at com.tibco.cep.kernel.core.rete.BeTransaction.execute(SourceFile:101)
    at com.tibco.cep.runtime.scheduler.impl.WorkerBasedControllerV2.executeTask(WorkerBasedControllerV2.java:421)
    at com.tibco.cep.runtime.scheduler.impl.WorkerBasedControllerV2$WorkerTask.run(WorkerBasedControllerV2.java:466)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at com.tibco.cep.runtime.util.CustomBEManagedThread.run(CustomBEManagedThread.java:24)
Caused by: java.lang.Exception: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
    at com.tibco.cep.driver.http.client.impl.httpcomponents.HttpComponentsClient$3.call(SourceFile:300)
    at com.tibco.cep.driver.http.client.impl.httpcomponents.HttpComponentsClient$3.call(SourceFile:269)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Issue/Introduction

How to resolve the exception "java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger" that occurs when using HTTP.sendRequest() in TIBCO BusinessEvents.

Resolution

Option 1:

Update the classpath settings in the be-engine.tra file to load the older version first.

On Windows:

tibco.env.CUSTOM_EXT_PREPEND_CP=%HAWK_HOME%/lib

On Linux:


Update LD_LIBRARY_PATH to have %HAWK_HOME%/lib in the be-engine.tra file.


Option 2:

Another option would be to move the slf4j-api-1.7.5.jar and slf4j-log4j12-1.7.5.jar from BE_HOME/lib/ext/tpcl to a different location so that the TIBCO BusinessEvents Engine will load an older version from the classpath (1.5.2 deployed with TRA/HAWK). Out of the two, the more prudent approach would be to update the classpath in the .tra file instead of dealing with original files.

Additional Information

BusinessEvents Engineering