Reputation: 10584
I am trying to use slf4j-api and log4j-over-slf4j, but I am running into following warnings
System.err: SLF4J: Class path contains multiple SLF4J bindings.
System.err: SLF4J: Found binding in [jar:file:/E:/developer/NewSandbox/MY_DEV_GRID_1/grid/applications/webproject/appdata/webapps/webproject-0.1.0/WEB-INF/lib/logback-classic-1.1.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
System.err: SLF4J: Found binding in [jar:file:/E:/developer/NewSandbox/MY_DEV_GRID_1/runtimes/2.0.20161021-083156/services/log/slf4j-grid-2.0.20161021-083156.jar!/org/slf4j/impl/StaticLoggerBinder.class]
System.err: SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
System.err: SLF4J: The requested version 1.7.16 by your slf4j binding is not compatible with [1.6]
System.err: SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
I am trying to understand where these multiple bindings are coming from. If I exclude logback-classic
through spring-boot-starter-logging
, I get linkage error like below
loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;"
Here is my dependency tree through gradle for slf4j-api
org.slf4j:slf4j-api:1.7.21 (selected by rule)
+--- org.slf4j:jcl-over-slf4j:1.7.21
| +--- org.springframework.data:spring-data-redis:1.7.6.RELEASE
| | +--- compile
| | \--- project :common
| | \--- compile
| +--- org.springframework.data:spring-data-keyvalue:1.1.5.RELEASE
| | \--- org.springframework.data:spring-data-redis:1.7.6.RELEASE (*)
| +--- org.springframework.data:spring-data-jpa:1.10.5.RELEASE
| | \--- org.springframework.boot:spring-boot-starter-data-jpa:1.4.2.RELEASE
| | \--- compile
| +--- org.springframework.boot:spring-boot-starter-logging:1.4.2.RELEASE
| | \--- org.springframework.boot:spring-boot-starter:1.4.2.RELEASE
| | +--- org.springframework.boot:spring-boot-starter-web:1.4.2.RELEASE
| | | \--- compile
| | +--- org.springframework.boot:spring-boot-starter-data-jpa:1.4.2.RELEASE (*)
| | +--- org.springframework.boot:spring-boot-starter-jersey:1.4.2.RELEASE
| | | \--- compile
| | +--- org.springframework.boot:spring-boot-starter-aop:1.4.2.RELEASE
| | | \--- org.springframework.boot:spring-boot-starter-data-jpa:1.4.2.RELEASE (*)
| | +--- org.springframework.boot:spring-boot-starter-jdbc:1.4.2.RELEASE
| | | \--- org.springframework.boot:spring-boot-starter-data-jpa:1.4.2.RELEASE (*)
| | \--- org.springframework.boot:spring-boot-starter-validation:1.4.2.RELEASE
| | \--- org.springframework.boot:spring-boot-starter-jersey:1.4.2.RELEASE (*)
| \--- org.springframework.data:spring-data-commons:1.12.5.RELEASE
| +--- org.springframework.data:spring-data-keyvalue:1.1.5.RELEASE (*)
| \--- org.springframework.data:spring-data-jpa:1.10.5.RELEASE (*)
+--- org.slf4j:jul-to-slf4j:1.7.21
| \--- org.springframework.boot:spring-boot-starter-logging:1.4.2.RELEASE (*)
+--- org.slf4j:log4j-over-slf4j:1.7.21
| \--- org.springframework.boot:spring-boot-starter-logging:1.4.2.RELEASE (*)
+--- org.springframework.data:spring-data-commons:1.12.5.RELEASE (*)
+--- org.springframework.data:spring-data-jpa:1.10.5.RELEASE (*)
\--- org.springframework.data:spring-data-keyvalue:1.1.5.RELEASE (*)
org.slf4j:slf4j-api:1.6.1 -> 1.7.21
+--- org.apache.bval:bval-core:0.3-incubating
| +--- org.apache.bval:org.apache.bval.bundle:0.3-incubating
| | \--- org.apache.openjpa:openjpa-maven-plugin:2.4.1
| | \--- compile
| \--- org.apache.bval:bval-jsr303:0.3-incubating
| \--- org.apache.bval:org.apache.bval.bundle:0.3-incubating (*)
\--- org.apache.bval:bval-jsr303:0.3-incubating (*)
org.slf4j:slf4j-api:1.6.3 -> 1.7.21
+--- io.swagger:swagger-core:1.5.0
| \--- io.swagger:swagger-jaxrs:1.5.0
| \--- io.swagger:swagger-jersey2-jaxrs:1.5.0
| \--- compile
\--- io.swagger:swagger-models:1.5.0
\--- io.swagger:swagger-core:1.5.0 (*)
org.slf4j:slf4j-api:1.7.5 -> 1.7.21
\--- com.microsoft.azure:adal4j:1.0.0
\--- com.microsoft.azure:azure-keyvault:0.9.3
\--- com.microsoft.sqlserver:mssql-jdbc:6.1.0.jre8
\--- compile
org.slf4j:slf4j-api:1.7.12 -> 1.7.21
\--- project :common
\--- compile
org.slf4j:slf4j-api:1.7.20 -> 1.7.21
\--- ch.qos.logback:logback-classic:1.1.7
\--- org.springframework.boot:spring-boot-starter-logging:1.4.2.RELEASE
\--- org.springframework.boot:spring-boot-starter:1.4.2.RELEASE
+--- org.springframework.boot:spring-boot-starter-web:1.4.2.RELEASE
| \--- compile
+--- org.springframework.boot:spring-boot-starter-data-jpa:1.4.2.RELEASE
| \--- compile
+--- org.springframework.boot:spring-boot-starter-jersey:1.4.2.RELEASE
| \--- compile
+--- org.springframework.boot:spring-boot-starter-aop:1.4.2.RELEASE
| \--- org.springframework.boot:spring-boot-starter-data-jpa:1.4.2.RELEASE (*)
+--- org.springframework.boot:spring-boot-starter-jdbc:1.4.2.RELEASE
| \--- org.springframework.boot:spring-boot-starter-data-jpa:1.4.2.RELEASE (*)
\--- org.springframework.boot:spring-boot-starter-validation:1.4.2.RELEASE
\--- org.springframework.boot:spring-boot-starter-jersey:1.4.2.RELEASE (*)
org.slf4j:slf4j-api:1.7.22 -> 1.7.21
\--- org.springframework.data:spring-data-redis:1.7.6.RELEASE
+--- compile
\--- project :common
\--- compile
Not sure what else I should try to resolve these warnings
Upvotes: 0
Views: 2971
Reputation: 3288
In my case, the extra configuration was coming from Apache Spark. Adding the Spark dependency as follows:
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.0.1</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
resolved the issue. How I figured it was a bit problematic though. I didn't have too many dependencies, so I added the exclusions
into every dependency and removed one by one. Hope it helps.
Upvotes: 4