I have a problem with my dependency tree and multiple SLF4J binding. What I found out so far is that usually this only causes a warning but in my case it seems to prevent my
I would suggest to use following dependency in maven instead,
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
This has solved my problem although I have more dependencies using slf4j.
This is occur when there is more than one jar. To check if there jar is already available or not go to project -> java resources -> maven dependencies and check if the jar is already available there or not . If its available and still you get the error . Then find the location of that jar file in .m2\resources folder and delete complete folder related to that jar file then download a newer version and import it to your project . :)
Sometime i get errors even i have download the right jar file with a right version in my pom.xml file. Then i need to remove it from my pom.xml and download that jar from google and import it to my project.Make sure if you do it then don't forget to go Project properties ->Deployment Assembly tab->Click Add ->Java Build Path Entries and Click on that jar file and Click apply .
Answer from Fateh is correct I had to spend some time to figure out how to use it, that's why I'm adding a complete solution:
Run mvn dependency:tree
find out which library is using slf4j:
[INFO] +- net.lightbody.bmp:browsermob-proxy:jar:2.0-beta-8:compile
[INFO] | +- org.slf4j:slf4j-jdk14:jar:1.7.25:compile
exclude it from maven like this:
<dependency>
<groupId>net.lightbody.bmp</groupId>
<artifactId>browsermob-proxy</artifactId>
<version>2.0.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
</exclusion>
</exclusions>
</dependency>
There are couple of solutions to this:
When multiple bindings are available on the class path, select one and only one binding you wish to use, and remove the other bindings.
Try removing explicitly added dependency of 'org.slf4j' or 'log4j2'.
If your project has dependency on other project and the other one use slf4j as well with different version try to use excusion
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>