Resolving Multiple SLF4J Binding Issue: Nutch in Eclipse

When trying to run nutch trunk in eclipse, we often get a multiple slf4j binding error like the following.

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/asmat/dev/trunk/build/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/asmat/dev/trunk/build/test/lib/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 [org.slf4j.impl.Log4jLoggerFactory]
Usage: Injector <crawldb> <url_dir>

This is because SLF4J is designed to bind with only one underlying logging framework at a time. If there are more than one binding found, SLF4J will give error listing the locations where the multiple bindings exist.

To resolve this issue, we need to remove one of the bindings listed in the error message. In our case, trying to run Nutch in eclipse:

  • right click on the nutch/trunk project and go to Build Path –> Configure Build Path

resolve multiple slf4j binding issue

  • Go to Java Build Path –> Libraries and look for slf4j-log4jxxx.jar – trunk/build/test/lib. Select and remove this library.

resolve multiple slf4j binding issue

  • Now click on Apply and Close and run your project again. You should see success message.

resolve multiple slf4j binding issue

Happy Crawling!

 

Useful Resources
  1. Web Crawling and Data Mining with Apache Nutch
  2. Solr in Action
  3. Apache Solr: A Beginner Guide
  4. Apache Hadoop YARN

Comments

comments

Leave a Reply

Your email address will not be published. Required fields are marked *