.NET Framework Project's Azure Pipeline Related to SonarQube Analysis task failing - version 10.6

Hello!
This is my first post here and I really appreciate this community for all the errors I have gotten past because of the support!

I am working with a few .NET Core projects and a few .NET framework projects where I am setting up Azure Pipelines to run a SonarQube Analysis. Recently in an attempt to fix some other errors ( Error after analysis - NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy ), we updated to using the latest SonarQube version 10.6. However, this caused errors in the current .NET Framework projects pipelines SonarQube Analysis task.

Here is the error message (sorry for no formatting)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)

at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)

at org.sonarsource.scanner.api.internal.batch.DefaultBatchFactory.createBatch(DefaultBatchFactory.java:32)

at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

##[error]at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)

##[error]at com.sun.proxy.$Proxy0.execute(Unknown Source)

at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)

at com.sun.proxy.$Proxy0.execute(Unknown Source)

at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)

##[error]at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)

at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)

##[error]at org.sonarsource.scanner.cli.Main.execute(Main.java:126)

at org.sonarsource.scanner.cli.Main.execute(Main.java:81)

at org.sonarsource.scanner.cli.Main.main(Main.java:62)

ERROR:

at org.sonarsource.scanner.cli.Main.execute(Main.java:126)

at org.sonarsource.scanner.cli.Main.execute(Main.java:81)

at org.sonarsource.scanner.cli.Main.main(Main.java:62)

ERROR:

##[error]The SonarScanner did not complete successfully

The SonarScanner did not complete successfully

##[error]10:35:03.272 Post-processing failed. Exit code: 1

10:35:03.272 Post-processing failed. Exit code: 1

I tried to find if someone else had any similar problems but couldn’t find much. Any help would be much appreciated!

Hey there.

The “real” error is probably above the section of logs that you posted. Can you post the complete logs?

Hello Colin!
Sorry about that, and thank you for your response :blush:

Here are the complete logs from that task

SonarScanner for MSBuild 5.15.1
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...
Attempting to locate the CodeCoverage.exe tool using registry...
WARNING: Failed to find the code coverage command line tool. Possible cause: Visual Studio is not installed, or the installed version does not support code coverage.
The TFS Processor has finished
Calling the SonarScanner CLI...

INFO: Project root configuration file: V:\AzureDevOpsAgent\_work\27\.sonarqube\out\sonar-project.properties
INFO: SonarScanner 4.8.1.3023
INFO: Java 11.0.23 Microsoft (64-bit)
INFO: Windows Server 2022 10.0 amd64
INFO: User cache: C:\Users\ma_azuredevops$\.sonar\cache
INFO: Analyzing on SonarQube server 10.6.0.92116
INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1.052s
INFO: Final Memory: 4M/20M
INFO: ------------------------------------------------------------------------
##[error]ERROR: Error during SonarScanner execution
java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to
ERROR: Error during SonarScanner execution


##[error]55.0
 55.0
##[error]at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1022)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
	at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:555)
	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1022)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
	at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:555)
	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
##[error]at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)
	at org.sonarsource.scanner.api.internal.batch.DefaultBatchFactory.createBatch(DefaultBatchFactory.java:32)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)
	at org.sonarsource.scanner.api.internal.batch.DefaultBatchFactory.createBatch(DefaultBatchFactory.java:32)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
##[error]at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1022)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
	at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:555)
	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
##[error]at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)
	at org.sonarsource.scanner.api.internal.batch.DefaultBatchFactory.createBatch(DefaultBatchFactory.java:32)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)
	at org.sonarsource.scanner.api.internal.batch.DefaultBatchFactory.createBatch(DefaultBatchFactory.java:32)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
##[error]at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
##[error]at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
##[error]at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
##[error]at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
ERROR:
	at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
ERROR: 
##[error]The SonarScanner did not complete successfully
The SonarScanner did not complete successfully
##[error]10:35:03.272  Post-processing failed. Exit code: 1
10:35:03.272  Post-processing failed. Exit code: 1
##[warning]LIB_ResourceFile does not exist
##[warning]Resource file haven't been set, can't find loc string for key: LIB_ProcessExitCode
##[warning]Error while executing SonarQube:Analyze task: LIB_ProcessExitCode V:\AzureDevOpsAgent\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.19.2\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe 1
##[error]LIB_ProcessExitCode V:\AzureDevOpsAgent\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.19.2\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe 1
Finishing: Run Code Analysis

So this is the real meat of the issue!

If Java 17 is installed on this build agent, you can set

   - task: SonarQubeAnalyze@5
     inputs:
              jdkversion: 'JAVA_HOME_17_X64

To make sure that Java 17 is used for the analysis.

Hello Colin!
Thank you so much for your help, that worked :blush:

Sincerely,
Yash

1 Like

Can you let me know where do I define that parameter? I am using CLI to test my project.

Hello Bipin!

In my case, the parameter was added to the Azure DevOps pipeline task to run the SonarQube analysis. I hope that helps!

Sincerely,
Yash

Thanks for that. Does anybody know how to update that parameter for Bamboo Pipeline?

@Bipin23

That sounds like a different issue, and this parameter doesn’t exist outside of Azure DevOps. Can you create a new post describing your issue, setup, config, logs…?

The issue has been resolved after we upgrade the scanner version to 6.1.

2 Likes