Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class path contains multiple SLF4J bindings

My application server ibm websphere. I'm getting the following error in the application server logs. Where can I websphere settings?

[19.09.2012 14:56:54:940 EEST] 0000000a SystemErr R SLF4J: Class path contains multiple SLF4J bindings.
[19.09.2012 14:56:54:940 EEST] 0000000a SystemErr R SLF4J: Found binding in [wsjar:file:/C:/Lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
[19.09.2012 14:56:54:941 EEST] 0000000a SystemErr R SLF4J: Found binding in [bundleresource://217.fwk37356669:1/org/slf4j/impl/StaticLoggerBinder.class]
[19.09.2012 14:56:54:941 EEST] 0000000a SystemErr R SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

like image 232
aliplane Avatar asked Sep 19 '12 12:09

aliplane


People also ask

How do I fix SLF4J class path contains multiple SLF4J bindings?

If you are looking for quick solution for this issue, you need to find out how log4j is present on your path. run mvn dependency:tree and figure out the maven dependency and exclude log4j with snippet below to that dependency in your pom. xml . This should resolve SLF4J: Class Path Contains Multiple SLF4J Bindings.

What are SLF4J bindings?

Bindings are basically implementations of a particular SLF4J class meant to be extended to plug in a specific logging framework. By design, SLF4J will only bind with one logging framework at a time. Consequently, if more than one binding is present on the classpath, it will emit a warning.

What is SLF4J reload4j?

2022-01-25 - Release of SLF4J 1.7. The reload4j project is a fork of Apache log4j version 1.2. 17 with the goal of fixing pressing security issues. It is intended as a drop-in replacement for log4j version 1.2. 17. By drop-in, we mean the replacement of log4j.


1 Answers

unfortunately, websphere has a lot of commonly used libraries in its own installation. They often conflict with the versions you want to use in your application.

The options are to remove the library jars from the application and use what websphere provides or change the class loader settings to 'parent last' to make sure the libs bundled with the app are found first. (this will not eliminate the slf4j warning, but will make sure your implementation is used).

Sorry, I can't give more details where the settings are found (its a few years that I last worked with websphere).

like image 107
Henry Avatar answered Oct 21 '22 17:10

Henry