1

enter image description here .

I'm trying to compile a java program using these jars(screenshot) but getting these errors:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/vanar/workspace/TwitterKafka/logback-classic-1.1.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/vanar/workspace/TwitterKafka/slf4j-log4j12-1.7.5.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 [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
Exception in thread "hosebird-client-io-thread-0" java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
 at org.apache.commons.logging.impl.SLF4JLocationAwareLog.debug(SLF4JLocationAwareLog.java:120)
 at org.apache.http.impl.conn.PoolingClientConnectionManager.shutdown(PoolingClientConnectionManager.java:276)
 at com.twitter.hbc.httpclient.ClientBase.run(ClientBase.java:165)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:745)

how do I ensure all these logging components work together? I am stumped as to what is compatible with what and do not know a way apart from trial and error which I tried with no luck. please help

cschneid
10.9k1 gold badge32 silver badges43 bronze badges
asked Sep 14, 2016 at 10:52
4
  • Are you sure you have only slf4j.jar in your class path? and is it the latest version? Commented Sep 14, 2016 at 10:56
  • Please post all of the libraries you are using. I think you might be using a lib which itself includes log4j with sfl4j. e.g storm-kafka Commented Sep 14, 2016 at 11:25
  • I'm using kafka-client jar in this. does this impact in any way? Commented Sep 14, 2016 at 11:50
  • if someone could suggest the pom.xml for me including the exclusions from the dependencies then this could work :-) Commented Sep 14, 2016 at 11:57

3 Answers 3

1

You can try to add logging jar files to endorsed directory.

answered Sep 14, 2016 at 11:07
3
  • I don't understand the "endorsed directory" in this case. Please elaborate Commented Sep 14, 2016 at 11:51
  • JRE endorsed directory under Linux is <java-home>/lib/endorsed. If you use Tomcat then "$CATALINA_HOME/endorsed" can be used. The goal is to make logging jar files avaliable through bootstrap or system class loader. Commented Sep 14, 2016 at 14:00
  • one more thing. if you do so then this jar files must be excluded from application class path. Provided scope can be used in case of Maven. Commented Sep 14, 2016 at 14:15
0

Use latest combination of slf4j-log4j .You are using older version of any one of this jars.

answered Sep 14, 2016 at 11:56
0

enter image description here

add log4j and sl4j jar in this combination. if any one is missing exception raised while logging.

answered Sep 14, 2016 at 12:08

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.