Sonar Scanner is not working

I have configured a SonarQube server on windows server 2022 and integrate it with Azure DevOps.

all the things are working fine but on Analysis stem my build gets failed and give me the error. Error is attached below:

  1. Starting: SonarQubeAnalyze

==============================================================================

Task : Run Code Analysis

Description : Run scanner and upload the results to the SonarQube server.

Version : 5.4.0

Author : sonarsource

Help : Version: 5.4.0. This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

More Information

==============================================================================

C:\agent_work_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.4.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe end

SonarScanner for MSBuild 5.5.3

Using the .NET Framework version of the Scanner for MSBuild

Post-processing started.

Calling the TFS Processor executable…

Attempting to locate the CodeCoverage.exe tool…

Attempting to locate the CodeCoverage.exe tool using setup configuration…

Code coverage command line tool: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe

Fetching code coverage report information from TFS…

Attempting to locate a test results (.trx) file…

Looking for TRX files in: C:\agent_work\2\TestResults

No test results files found

Did not find any binary coverage files in the expected location.

Falling back on locating coverage files in the agent temp directory.

Searching for coverage files in C:\agent_work_temp

No coverage files found in the agent temp directory.

Coverage report conversion completed successfully.

The TFS Processor has finished

Calling the SonarScanner CLI…

INFO: Scanner configuration file: C:\agent_work_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.4.0\classic-sonar-scanner-msbuild\sonar-scanner-4.6.2.2472\bin…\conf\sonar-scanner.properties

INFO: Project root configuration file: C:\agent_work\2.sonarqube\out\sonar-project.properties

INFO: SonarScanner 4.6.2.2472

INFO: Java 1.8.0_321 Oracle Corporation (64-bit)

INFO: Windows 10 10.0 amd64

INFO: User cache: C:\Users\tfs.build.sonar\cache

INFO: Scanner configuration file: C:\agent_work_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.4.0\classic-sonar-scanner-msbuild\sonar-scanner-4.6.2.2472\bin…\conf\sonar-scanner.properties

INFO: Project root configuration file: C:\agent_work\2.sonarqube\out\sonar-project.properties

INFO: Analyzing on SonarQube server 9.4.0

INFO: Default locale: “en_US”, source code encoding: “windows-1252” (analysis is platform dependent)

INFO: ------------------------------------------------------------------------

INFO: EXECUTION FAILURE

INFO: ------------------------------------------------------------------------

Hey there.

It looks like the very end of the logs are missing (as if only stdout was given, not `stderr) where we see what the real problem is. Are there more logs to share?

hi @Colin following are the full logs:

2022-04-25T16:27:27.6081437Z ##[section]Starting: SonarQubeAnalyze
2022-04-25T16:27:27.6148738Z ==============================================================================
2022-04-25T16:27:27.6148946Z Task : Run Code Analysis
2022-04-25T16:27:27.6149127Z Description : Run scanner and upload the results to the SonarQube server.
2022-04-25T16:27:27.6149292Z Version : 5.4.0
2022-04-25T16:27:27.6149416Z Author : sonarsource
2022-04-25T16:27:27.6149749Z Help : Version: 5.4.0. This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

More Information
2022-04-25T16:27:27.6150142Z ==============================================================================
2022-04-25T16:27:27.7609467Z [command]C:\agent_work_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.4.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe end
2022-04-25T16:27:27.7942296Z SonarScanner for MSBuild 5.5.3
2022-04-25T16:27:27.7944159Z Using the .NET Framework version of the Scanner for MSBuild
2022-04-25T16:27:27.8236439Z Post-processing started.
2022-04-25T16:27:29.3402786Z 21:27:29.333 21:27:29.333 WARNING: File ‘C:\agent_work\3\s\SOURCE\VidizmoWebApplication\VidizmoWebApplication\Client\src\app\theme-one\pages\private-playlist\file.ts’ does not exist.
2022-04-25T16:27:29.4022460Z Calling the TFS Processor executable…
2022-04-25T16:27:29.5399472Z Attempting to locate the CodeCoverage.exe tool…
2022-04-25T16:27:29.5424941Z Attempting to locate the CodeCoverage.exe tool using setup configuration…
2022-04-25T16:27:29.5508224Z Code coverage command line tool: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe
2022-04-25T16:27:29.5859942Z Fetching code coverage report information from TFS…
2022-04-25T16:27:29.5870409Z Attempting to locate a test results (.trx) file…
2022-04-25T16:27:30.4037224Z Looking for TRX files in: C:\agent_work\3\TestResults
2022-04-25T16:27:30.4039405Z No test results files found
2022-04-25T16:27:31.2053944Z Did not find any binary coverage files in the expected location.
2022-04-25T16:27:31.2062200Z Falling back on locating coverage files in the agent temp directory.
2022-04-25T16:27:31.2065537Z Searching for coverage files in C:\agent_work_temp
2022-04-25T16:27:31.2067784Z No coverage files found in the agent temp directory.
2022-04-25T16:27:31.2068228Z Coverage report conversion completed successfully.
2022-04-25T16:27:31.2116441Z The TFS Processor has finished
2022-04-25T16:27:31.2146590Z Calling the SonarScanner CLI…
2022-04-25T16:27:31.3476411Z INFO: Scanner configuration file: C:\agent_work_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.4.0\classic-sonar-scanner-msbuild\sonar-scanner-4.6.2.2472\bin…\conf\sonar-scanner.properties
2022-04-25T16:27:31.3483286Z INFO: Project root configuration file: C:\agent_work\3.sonarqube\out\sonar-project.properties
2022-04-25T16:27:31.4285513Z INFO: SonarScanner 4.6.2.2472
2022-04-25T16:27:31.4285909Z INFO: Java 1.8.0_321 Oracle Corporation (64-bit)
2022-04-25T16:27:31.4286090Z INFO: Windows 10 10.0 amd64
2022-04-25T16:27:31.6893674Z INFO: User cache: C:\Users\tfs.build.sonar\cache
2022-04-25T16:27:31.9304876Z INFO: Scanner configuration file: C:\agent_work_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.4.0\classic-sonar-scanner-msbuild\sonar-scanner-4.6.2.2472\bin…\conf\sonar-scanner.properties
2022-04-25T16:27:31.9305821Z INFO: Project root configuration file: C:\agent_work\3.sonarqube\out\sonar-project.properties
2022-04-25T16:27:31.9850644Z INFO: Analyzing on SonarQube server 9.4.0
2022-04-25T16:27:31.9851660Z INFO: Default locale: “en_US”, source code encoding: “windows-1252” (analysis is platform dependent)
2022-04-25T16:27:31.9872545Z INFO: ------------------------------------------------------------------------
2022-04-25T16:27:31.9872969Z INFO: EXECUTION FAILURE
2022-04-25T16:27:31.9874590Z INFO: ------------------------------------------------------------------------
2022-04-25T16:27:31.9875177Z INFO: Total time: 0.656s
2022-04-25T16:27:32.0005496Z INFO: Final Memory: 11M/489M
2022-04-25T16:27:32.0005916Z INFO: ------------------------------------------------------------------------
2022-04-25T16:27:32.0009144Z ##[error]ERROR: Error during SonarScanner execution
2022-04-25T16:27:32.0009827Z ERROR: Error during SonarScanner execution
2022-04-25T16:27:32.0011680Z ##[error]java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
2022-04-25T16:27:32.0013360Z java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
2022-04-25T16:27:32.0013769Z at java.lang.ClassLoader.defineClass1(Native Method)
2022-04-25T16:27:32.0014450Z at java.lang.ClassLoader.defineClass(Unknown Source)
2022-04-25T16:27:32.0014664Z at java.security.SecureClassLoader.defineClass(Unknown Source)
2022-04-25T16:27:32.0014882Z at java.net.URLClassLoader.defineClass(Unknown Source)
2022-04-25T16:27:32.0015093Z at java.net.URLClassLoader.access$100(Unknown Source)
2022-04-25T16:27:32.0015291Z at java.net.URLClassLoader$1.run(Unknown Source)
2022-04-25T16:27:32.0015493Z at java.net.URLClassLoader$1.run(Unknown Source)
2022-04-25T16:27:32.0015702Z at java.security.AccessController.doPrivileged(Native Method)
2022-04-25T16:27:32.0015910Z at java.net.URLClassLoader.findClass(Unknown Source)
2022-04-25T16:27:32.0017221Z ##[error]at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.sonarsource.scanner.api.internal.batch.DefaultBatchFactory.createBatch(DefaultBatchFactory.java:32)
2022-04-25T16:27:32.0018217Z at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
2022-04-25T16:27:32.0018722Z at java.lang.ClassLoader.loadClass(Unknown Source)
2022-04-25T16:27:32.0019315Z at org.sonarsource.scanner.api.internal.batch.DefaultBatchFactory.createBatch(DefaultBatchFactory.java:32)
2022-04-25T16:27:32.0020248Z ##[error]at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2022-04-25T16:27:32.0021267Z at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
2022-04-25T16:27:32.0021767Z at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2022-04-25T16:27:32.0021988Z at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2022-04-25T16:27:32.0022604Z ##[error]at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
2022-04-25T16:27:32.0023166Z at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2022-04-25T16:27:32.0023404Z at java.lang.reflect.Method.invoke(Unknown Source)
2022-04-25T16:27:32.0024075Z ##[error]at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
2022-04-25T16:27:32.0025122Z at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
2022-04-25T16:27:32.0025392Z at com.sun.proxy.$Proxy0.execute(Unknown Source)
2022-04-25T16:27:32.0026134Z ##[error]at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
2022-04-25T16:27:32.0026817Z at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
2022-04-25T16:27:32.0027117Z at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
2022-04-25T16:27:32.0027790Z ##[error]at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
2022-04-25T16:27:32.0028324Z at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
2022-04-25T16:27:32.0028568Z at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
2022-04-25T16:27:32.0029109Z ##[error]at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR:
2022-04-25T16:27:32.0029573Z at org.sonarsource.scanner.cli.Main.main(Main.java:61)
2022-04-25T16:27:32.0029756Z ERROR:
2022-04-25T16:27:32.5001196Z ##[error]The SonarScanner did not complete successfully
2022-04-25T16:27:32.5002057Z The SonarScanner did not complete successfully
2022-04-25T16:27:32.5003936Z ##[error]21:27:32.486 Post-processing failed. Exit code: 1
2022-04-25T16:27:32.5004453Z 21:27:32.486 Post-processing failed. Exit code: 1
2022-04-25T16:27:32.5119135Z ##[error]The process ‘C:\agent_work_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.4.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe’ failed with exit code 1
2022-04-25T16:27:32.5157473Z ##[section]Finishing: SonarQubeAnalyze

Take a look at this thread and the documentation on Scanner Environment