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
-
Are you sure you have only slf4j.jar in your class path? and is it the latest version?Techidiot– Techidiot09/14/2016 10:56:23Commented 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-kafkaSomnath Sarode– Somnath Sarode09/14/2016 11:25:30Commented Sep 14, 2016 at 11:25
-
I'm using kafka-client jar in this. does this impact in any way?Aman Mundra– Aman Mundra09/14/2016 11:50:44Commented 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 :-)Aman Mundra– Aman Mundra09/14/2016 11:57:07Commented Sep 14, 2016 at 11:57
3 Answers 3
You can try to add logging jar files to endorsed directory.
-
I don't understand the "endorsed directory" in this case. Please elaborateAman Mundra– Aman Mundra09/14/2016 11:51:45Commented 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.Sergey Bespalov– Sergey Bespalov09/14/2016 14:00:28Commented 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.Sergey Bespalov– Sergey Bespalov09/14/2016 14:15:08Commented Sep 14, 2016 at 14:15
Use latest combination of slf4j-log4j .You are using older version of any one of this jars.
add log4j and sl4j jar in this combination. if any one is missing exception raised while logging.