Error:
SLF4J(E): A service provider failed to instantiate:
org.slf4j.spi.SLF4JServiceProvider: Error accessing configuration file
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
Exception in thread "main" java.lang.ClassCastException: class org.slf4j.helpers.NOPLogger cannot be cast to class ch.qos.logback.classic.Logger (org.slf4j.helpers.NOPLogger and ch.qos.logback.classic.Logger are in unnamed module of loader 'app')
at org.sonarsource.scanner.cli.Cli.processNextArg(Cli.java:92)
at org.sonarsource.scanner.cli.Cli.parse(Cli.java:70)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
The full command invoke scanner is(start from my CI bat):
sonar-scanner.bat -Dsonar.projectKey=win-ci-demo -Dsonar.projectBaseDir=%ROOT_DIR% -Dsonar.sources=“%SRC_DIR%” -Dsonar.cxx.cppcheck.reportPaths=./build/cppcheck-result.xml -Dsonar.cxx.cobertura.reportPaths=./build/coverage-result.xml -X
Hi,
Below is the error scene when I manually execute my post.bat script : post.bat.txt (1.2 KB)
I have an extra clue: I was using Windows Svr 2022 Std in Korean, and then changed the language to Simplified Chinese
PS C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo> .\scripts\win32\post.bat
ROOT_DIR directory: C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo
SCRIPT_DIR directory is: C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo\scripts\win32\
ROOT_DIR directory is: C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo
BUILD_DIR directory is: C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo\build
SRC_DIR directory is: C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo\src
Checking C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo\src\gcovr\gcovr-test.cpp ...
[info] Start Program:
Path:"C:\\Users\\ncl_intdev!\\actions-runner\\_work\\gitaction-ci-demo\\gitaction-ci-demo\\bin\\Debug\\gcovr-test.exe"
Arguments:
Working directory: not set.
Modules: Selected: C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo\bin\Debug\gcovr-test.exe Excluded:
Sources: Selected: C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo\src Excluded:
Log Level: Normal
Cover Children: 0
Aggregate by file: 1
Continue after C++ exception: 0
Optimized build support: 0
Export: cobertura coverage-result.xml
Input coverage:
Unified diff:
Excluded line regular expressions:
Substitute pdb source paths:
[info] Module: C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo\bin\Debug\gcovr-test.exe is selected because it matches selected pattern: C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo\bin\Debug\gcovr-test.exe
just a gcovr test!
[info] ----------------------------------------------------
[info] Cobertura report generated: coverage-result.xml
[info] ----------------------------------------------------
[info] The code coverage report is not what you expect? See the FAQ https://github.com/OpenCppCoverage/OpenCppCoverage/wiki/FAQ.
SLF4J(E): A service provider failed to instantiate:
org.slf4j.spi.SLF4JServiceProvider: Error accessing configuration file
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
Exception in thread "main" java.lang.ClassCastException: class org.slf4j.helpers.NOPLogger cannot be cast to class ch.qos.logback.classic.Logger (org.slf4j.helpers.NOPLogger and ch.qos.logback.classic.Logger are in unnamed module of loader 'app')
at org.sonarsource.scanner.cli.Cli.processNextArg(Cli.java:92)
at org.sonarsource.scanner.cli.Cli.parse(Cli.java:70)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
PS C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo>
All I see here is the command to execute your script, from which analysis is presumably kicked off.
The problem I’m seeing is that while the stacktrace includes org.sonarsource.scanner.cli..., I don’t see anything in your log before that that relates directly to the scanner or indicates in any way that the scanner has actually been invoked.
Can you either modify your script to echo out the commands before it runs them or set the script aside and run each command manually from the command line. And whichever option you choose, provide the text of the entire log file?
Hello,
If I excute command in commandline,the output is follow:
PS C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo\build> sonar-scanner.bat -Dsonar.projectKey=win-ci-demo -Dsonar.projectBaseDir="C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo" -Dsonar.sources="C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo\src" -Dsonar.cxx.cppcheck.reportPaths=./build/cppcheck-result.xml -Dsonar.cxx.cobertura.reportPaths=./build/coverage-result.xml -X
DEBUG: 1+ >>>> sonar-scanner.bat -Dsonar.projectKey=win-ci-demo
-Dsonar.projectBaseDir="C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo"
-Dsonar.sources="C:\Users\ncl_intdev!\actions-runner\_work\gitaction-ci-demo\gitaction-ci-demo\src"
-Dsonar.cxx.cppcheck.reportPaths=./build/cppcheck-result.xml
-Dsonar.cxx.cobertura.reportPaths=./build/coverage-result.xml -X
SLF4J(E): A service provider failed to instantiate:
org.slf4j.spi.SLF4JServiceProvider: Error accessing configuration file
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
usage: sonar-scanner [options]
Options:
-D,--define <arg> Define property
-h,--help Display help information
-v,--version Display version information
-X,--debug Produce execution debug output
The previously mentioned “Exception in thread “main” java.lang.ClassCastException:” error message was obtained by executing bat through Github-Actions. I don’t know the difference, but I can be sure that by setting different Github-Actions runners, it can be executed normally on the win10 system and get the expected results without exception.