LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Talend Log4J competing implementation error

Highlighted
Five Stars

LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Talend Log4J competing implementation error

Hey all,

 

I've run into a problem after building a very simple Route that I use for a demo. Some information

on my configurations.

  • I'm running Talend Cloud Real-Time Big Data Platform version 7.2.1
  • I'm using Java SE 8 [1.8.0_151] (but i've also tried 1.8.0_171)
  • The bindings shown in Talend are as follows:

    Starting job PostDataConsumer at 10:47 19/09/2019.

     

    SLF4J: Class path contains multiple SLF4J bindings.

    SLF4J: Found binding in [jar:file:/*/Talend/Talend-Studio-20190620_1446-V7.2.1/configuration/.m2/repository/org/apache/activemq/activemq-all/5.15.9/activemq-all-5.15.9.jar!/org/slf4j/impl/StaticLoggerBinder.class]

    SLF4J: Found binding in [jar:file:/*/Talend/Talend-Studio-20190620_1446-V7.2.1/configuration/.m2/repository/org/talend/libraries/slf4j-log4j12-1.7.5/6.0.0/slf4j-log4j12-1.7.5-6.0.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]

    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

    SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]

    [statistics] connecting to socket on port 3715

    [statistics] connected

     

    Job PostDataConsumer ended at 10:47 19/09/2019. [exit code=0]

Whenever i try to run the PostDataConsumer.sh file (made by Talend after I build the route) i get the following error:

 

Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.Log4jLoggerFactory loaded from jar:file:/Users/jessevanderwolf/Documents/Projects/School/IntoData/SimpleMicroserviceUseCase/PostDataConsumer/PostDataConsumer_0.1.jar!/BOOT-INF/lib/slf4j-log4j12-1.7.5-6.0.0.jar!/). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.impl.Log4jLoggerFactory
at org.springframework.util.Assert.instanceCheckFailed(Assert.java:655)
at org.springframework.util.Assert.isInstanceOf(Assert.java:555)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:286)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:102)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:220)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:199)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:69)
at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
at microservices.postdataconsumer_0_1.PostDataConsumer.main(PostDataConsumer.java:353)
... 8 more

 

I've already tried the following:

  1. Disable Log4j in compontents via File > Project Settings > Log4j
  2. Make an exclusion like the documentation -> http://www.slf4j.org/codes.html#multiple_bindings suggests
  3. use different Java jdk's [1.8.0_151, 1.8.0_171]

Hope you guys can help me out.


Accepted Solutions
Highlighted
Five Stars

Re: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Talend Log4J competing implementation error

Seems like downloading the latest patch fixed the issue. The build where i encountered the issue 

was as follows:

 

Version: 7.2.1

Build id: 20190725_0259

 

The latest patch i downloaded via the talend portal, configured and tested the route on

was as follows:

 

Version: 7.2.1

Build id: 20190909_1200_patch

 

You can look up this in information in the studio via Talend Studio > About talend studio.

View solution in original post


All Replies
Highlighted
Moderator

Re: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Talend Log4J competing implementation error

Hello,

Could you please post the full error stack trace here? We have a known ESB issue in V 7.2.1.

Are you running your route as MicroService jar?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Highlighted
Five Stars

Re: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Talend Log4J competing implementation error

Hey xdshi,

 

I've added the stack trace to the main question.

 

I'm using a Talend route which contains a cMQConnectionfactory component and a cJMS componentent. It also calls a subjob. This is because the standard cHttp component in the route did not work (different issue) so I used a subjob to do a Http request using the tHttpRequest component.

 

I've also added the Talend project in a zipfile.

 

Jesse

Highlighted
Four Stars

Re: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Talend Log4J competing implementation error

Hi 

Just a follow up also experiencing the same problem on ESB 7.2.1 when exporting as a micro service.jar to docker. What is the current state of the bug and is there any work around that can be used?

Regards,

Highlighted
Five Stars

Re: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Talend Log4J competing implementation error

Seems like downloading the latest patch fixed the issue. The build where i encountered the issue 

was as follows:

 

Version: 7.2.1

Build id: 20190725_0259

 

The latest patch i downloaded via the talend portal, configured and tested the route on

was as follows:

 

Version: 7.2.1

Build id: 20190909_1200_patch

 

You can look up this in information in the studio via Talend Studio > About talend studio.

View solution in original post

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Self-service Talend Migration: Moving from On-Premises to the Cloud

Move from On-Premises to the Cloud by following the advice of experts

Read Now

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How to deploy Talend Jobs as Docker images to Amazon, Azure and Google Cloud reg...

Learn how to deploy Talend Jobs as Docker images to Amazon, Azure and Google Cloud registries

Blog