SLF4J: Class path contains multiple SLF4J bindings

Must-share information (formatted with Markdown):

which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
We are using an on premis Sonarqube instance developer edition version 7.9.1 in combination with
Azure pipelines on microsofts azure enviroment. With the following Azure tasks:

  • Prepare Analysis Configuration (version 4.8.0)
  • Run Code Analysis (version 4.8.0)
  • Publish Quality Gate Result (version 4.8.1)

and it uses

  • SonarScanner for MSBuild (version 4.7.1)

What are you trying to achieve
We are using Sonar in combination with PR controle in a classic CI/CD strategy. So we want to check our C# code to be checked by a PR.
Everything goes well. The analyses comes to an end and we see the results both in Sonar and in Azure. But in the process of running the code analysis we get the following error:

##[error]SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Class path contains multiple SLF4J bindings.
##[error]SLF4J: Found binding in [jar:file:/C:/Users/<Username>/.sonar/cache/a1c05423113146c25aa5a0819888ceec/sonar-scanner-engine-shaded-7.9.1-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/<Username>/.sonar/cache/d24ab21450b3b6d61e6868e70eb27a46/scanner-developer-7.9.1-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Found binding in [jar:file:/C:/Users/<Username>/.sonar/cache/a1c05423113146c25aa5a0819888ceec/sonar-scanner-engine-shaded-7.9.1-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/<Username>/.sonar/cache/d24ab21450b3b6d61e6868e70eb27a46/scanner-developer-7.9.1-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
##[error]SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

We want to get rid of this error because it’s distracting and gives a bunch of red lines in Azure.
But we don’t know how.

Hi,
Could you please post the full logs of the scanner with debug enabled?
I’m unable to reproduce the problem.

Hi @dmeneses
I have the same issue, and since updating to version 8, none of our metrics have worked.
INFO: Scanner configuration file: D:\agent6_work_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.8.0\classic-sonar-scanner-msbuild\sonar-scanner-4.1.0.1829\bin…\conf\sonar-scanner.properties
INFO: Project root configuration file: D:\agent6_work\1.sonarqube\out\sonar-project.properties
INFO: SonarQube Scanner 4.1.0.1829
INFO: Java 1.8.0_181 Oracle Corporation (64-bit)
INFO: Windows Server 2016 10.0 amd64
INFO: User cache: C:\Windows\ServiceProfiles\NetworkService.sonar\cache
INFO: SonarQube server 8.0.0
INFO: Default locale: “en_GB”, source code encoding: “windows-1252” (analysis is platform dependent)
##[error]SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/6abbcd30a9bf1fba1794eb6ce16eb36f/scanner-developer-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/6abbcd30a9bf1fba1794eb6ce16eb36f/scanner-developer-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
##[error]SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/9f2b37948b00b865aaf57dfd335e8d6a/sonar-scanner-engine-shaded-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/9f2b37948b00b865aaf57dfd335e8d6a/sonar-scanner-engine-shaded-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
##[error]SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
WARN: SonarScanner will require Java 11+ to run starting in SonarQube 8.x

Hi,
The errors in the logs shouldn’t have any effect on metrics. What exactly is the problem you have with metrics?
Could you show the scanner logs with debug enabled?

The errors may or may not have any effect on the metrics. The effect is on trust for your tool. Integrated into Azure DevOps, when we build projects, we see blood on the screen. Seeing these errors creates the cracked windows situation. People get used to seeing so much red that they begin to distrust the “quality” tool.
I’m asking for help here to know how to get SonarQube to use the right binding for SLF4J and not display any more of those errors in every build we run. I’m sure you can appreciate how unsightly it looks.


I’m not sure how the logs with debug enabled makes a difference:

10:56:41.362 INFO: Scanner configuration file: D:\agent6\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.8.0\classic-sonar-scanner-msbuild\sonar-scanner-4.1.0.1829\bin\..\conf\sonar-scanner.properties
10:56:41.378 INFO: Project root configuration file: D:\agent6\_work\1\.sonarqube\out\sonar-project.properties
10:56:41.480 INFO: SonarQube Scanner 4.1.0.1829
10:56:41.480 INFO: Java 1.8.0_181 Oracle Corporation (64-bit)
10:56:41.480 INFO: Windows Server 2016 10.0 amd64
10:56:41.644 DEBUG: keyStore is : 
10:56:41.644 DEBUG: keyStore type is : jks
10:56:41.644 DEBUG: keyStore provider is : 
10:56:41.644 DEBUG: init keystore
10:56:41.644 DEBUG: init keymanager of type SunX509
10:56:41.831 DEBUG: Create: C:\Windows\ServiceProfiles\NetworkService\.sonar\cache
10:56:41.831 INFO: User cache: C:\Windows\ServiceProfiles\NetworkService\.sonar\cache
10:56:41.831 DEBUG: Create: C:\Windows\ServiceProfiles\NetworkService\.sonar\cache\_tmp
10:56:41.831 DEBUG: Extract sonar-scanner-api-batch in temp...
10:56:41.847 DEBUG: Get bootstrap index...
10:56:41.847 DEBUG: Download: http://onprem.server.com:9000/sonarqube/batch/index
10:56:41.894 DEBUG: Get bootstrap completed
10:56:41.909 DEBUG: Create isolated classloader...
10:56:41.925 DEBUG: Start temp cleaning...
10:56:41.925 DEBUG: Temp cleaning done
10:56:41.925 DEBUG: Execution getVersion
10:56:41.925 INFO: SonarQube server 8.0.0
10:56:41.941 INFO: Default locale: "en_GB", source code encoding: "windows-1252" (analysis is platform dependent)
10:56:41.941 DEBUG: Work directory: D:\agent6\_work\1\.sonarqube\out\.sonar
10:56:41.941 DEBUG: Execution execute
##[error]SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/6abbcd30a9bf1fba1794eb6ce16eb36f/scanner-developer-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
##[debug]Processed: ##vso[task.logissue type=error;]SLF4J: Class path contains multiple SLF4J bindings.%0D%0ASLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/6abbcd30a9bf1fba1794eb6ce16eb36f/scanner-developer-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/6abbcd30a9bf1fba1794eb6ce16eb36f/scanner-developer-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
##[error]SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/9f2b37948b00b865aaf57dfd335e8d6a/sonar-scanner-engine-shaded-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
##[debug]Processed: ##vso[task.logissue type=error;]SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/9f2b37948b00b865aaf57dfd335e8d6a/sonar-scanner-engine-shaded-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]%0D%0ASLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/9f2b37948b00b865aaf57dfd335e8d6a/sonar-scanner-engine-shaded-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
##[error]SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
##[debug]Processed: ##vso[task.logissue type=error;]SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
10:56:42.175 WARN: SonarScanner will require Java 11+ to run starting in SonarQube 8.x
10:56:42.175 DEBUG: Developer 8.0.0.29455
10:56:42.284 INFO: Load global settings
10:56:42.331 DEBUG: GET 200 http://onprem.server.com:9000/sonarqube/api/settings/values.protobuf | time=47ms
10:56:42.378 INFO: Load global settings (done) | time=94ms
10:56:42.378 INFO: Server id: E1B7AF84-AWsEmPSb9ESnMY4kdDO5
10:56:42.378 INFO: User cache: C:\Windows\ServiceProfiles\NetworkService\.sonar\cache
10:56:42.378 INFO: Load/download plugins
10:56:42.378 INFO: Load plugins index
10:56:42.394 DEBUG: GET 200 http://onprem.server.com:9000/sonarqube/api/plugins/installed | time=0ms
10:56:42.425 INFO: Load plugins index (done) | time=47ms
10:56:42.862 INFO: Load/download plugins (done) | time=484ms
10:56:43.019 DEBUG: Plugins:
10:56:43.019 DEBUG:   * SonarCFamily 6.5.0.12506 (cpp)
10:56:43.019 DEBUG:   * SonarPython 2.3.0.5351 (python)
10:56:43.019 DEBUG:   * SonarCSS 1.1.1.1010 (cssfamily)
10:56:43.019 DEBUG:   * JaCoCo 1.0.2.475 (jacoco)
10:56:43.019 DEBUG:   * SonarGo 1.6.0.719 (go)
10:56:43.019 DEBUG:   * SonarKotlin 1.5.0.315 (kotlin)
10:56:43.019 DEBUG:   * SonarTSQL 1.4.0.3334 (tsql)
10:56:43.019 DEBUG:   * Svn 1.9.0.1295 (scmsvn)
10:56:43.019 DEBUG:   * SonarJS 6.1.0.11503 (javascript)
10:56:43.019 DEBUG:   * SonarPLSQL 3.4.1.2576 (plsql)
10:56:43.019 DEBUG:   * Vulnerability Rules for C# 8.0.0.5505 (securitycsharpfrontend)
10:56:43.019 DEBUG:   * License for SonarLint 8.0 (license)
10:56:43.019 DEBUG:   * SonarC# 8.1.0.13383 (csharp)
10:56:43.019 DEBUG:   * Vulnerability Analysis 8.0.0.5505 (security)
10:56:43.019 DEBUG:   * SonarHTML 3.2.0.2082 (web)
10:56:43.019 DEBUG:   * Git 1.9.1.1834 (scmgit)
10:56:43.019 DEBUG:   * SonarFlex 2.5.1.1831 (flex)
10:56:43.019 DEBUG:   * SonarXML 2.0.1.2020 (xml)
10:56:43.019 DEBUG:   * SonarTS 2.1.0.4359 (typescript)
10:56:43.019 DEBUG:   * SonarVB 8.1.0.13383 (vbnet)
10:56:43.019 DEBUG:   * SonarABAP 3.8.0.2034 (abap)
10:56:43.019 DEBUG:   * SonarSwift 4.2.2.77 (swift)
10:56:43.050 INFO: Loaded core extensions: developer-scanner
10:56:43.066 DEBUG: Installed core extension: developer-scanner
10:56:43.581 INFO: Process project properties
10:56:43.737 INFO: Process project properties (done) | time=156ms

No one is challenging the fact that seeing error logs is not good.
When investigating the problem, it obviously matters if metrics are affected or not because that would lead us to a completely different direction.
We only know if the logs in debug make a difference or not once they are posted. It often does make a difference when it comes to problems in the scanner side, hence me requesting it.

Could you please check what files you have in sonarqube_server_home/lib/scanner? Did you upgrade the server installation from Community Edition to Developer Edition at some point?

I suspect that a file was left over from an upgrade and there are 2 files: sonar-scanner-engine-shaded-8.0-all.jar and scanner-developer-8.0-all.jar.
If that’s the case, please delete sonar-scanner-engine-shaded-8.0-all.jar and restart the server.

1 Like

Thanks for your response. This is a fresh install of version 8 developer edition. The database was upgraded from version 7.9 developer edition. I can check the contents of that folder tomorrow.
I guess my frustration is that I am not the only one experiencing it and there seems to be no attention given to this issue.

EDIT
Here’s the folder:

This solved the problem! Deleting the engine shaded.
Thank you Duarte!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.