Skip to main content

Posts

Showing posts with the label SonarQube

SonarQube–The ‘MakeUniqueDir’ task failed unexpectedly

In our efforts to improve the (code) quality of our applications, we started an initiative to get all our teams integrate their projects in SonarQube. We have SonarQube running for a long time inside our organization, but adoption remained fragmented. The initiative turned out quite successful, but as a consequence, we encountered some issues with SonarQube. Teams started to complain that there build pipelines became flaky and sometimes resulted in errors. The reported error was related to SonarQube and the message was like this: Error MBS0418: The ‘MakeUniqueDir’ task failed unexpectedly. System.UnauthorizedAccessException: Access to the path ‘’'db1_work80_sonarqubeout’ is denied. We found out that the problem was related to our build server setup where we have multiple agents running on the same server. As multiple agents try to execute the ’Prepare Analysis’ task, it sometimes fails with the error message above. Furher research brought us to the NodeReuse parameter of...

SonarQube–Connecting to an on-premise Azure DevOps failed

After successfully installing a new SonarQube server, I followed the documented steps to configure the Azure DevOps integration. However when trying to register our on premise Azure DevOps instance, SonarQube throwed the following exception: 2025.02.10 11:47:30 ERROR web[13308e38-2d1a-46ae-80d9-baa54c12ffac][o.s.a.c.a.AzureDevOpsHttpClient] Unable to contact Azure DevOps server for request [https://azuredevops.server.be/tfs/defaultcollection/_apis/projects?api-version=3.0]: [PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target I found an old post online that links this error message to a problem with our SSL certificate. It seems that Java is unable to recognize the root certificate authority (CA). This could make sense as our internal Azure DevOps instance is using an SSL certificate signed by an internal root certificate. To fix the issue, I followed the steps described in the post: ...

Azure DevOps– The SonarScanner did not complete successfully

As part of our build process we use SonarQube for our code quality analysis. However after upgrading to the latest version of the SonarQube tasks for Azure DevOps, we encountered the following error message "The SonarScanner did not complete successfully." This seemingly vague error can stop your build pipeline dead in its tracks, leaving us scratching our head about what went wrong. Here is the full stack trace: at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451) ##[error]at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82) at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82) ##[error]at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ##[error]at org.sonarsource.scanner.api.internal.batch.DefaultBatchFactory.createBatch(DefaultBatchFactory.java:32) at org.sonarsource....

SonarQube–Error after updating the Prepare Analysis Task in Azure DevOps

I noticed when running a pipeline in Azure DevOps that I got some warnings on the SonarQube related tasks. It complained that I should update to a newer version. So I thought why not and updated the related tasks to the latest version (7.* at the moment of writing this post). However when I tried to run the pipeline again afterwards it no longer worked and failed on the Prepare Analysis Task: Starting: Prepare analysis on SonarQube ============================================================================== Task : Prepare Analysis Configuration Description : Prepare SonarQube Server analysis configuration Version : 7.1.1 Author : sonarsource Help : [More Information]( https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scanners/sonarqube-extension-for-azure-devops/ ) ============================================================================== ##[error][ERROR] SonarQube Server: Error while executing task Prepare: Use 'scannerMode: dotnet' ...

Azure DevOps–Update to the v3.x build agents

A colleague trying to add SonarQube integration to his build pipeline in Azure DevOps, contacted me because he got an error in his build pipeline. This is the error he got: ##[error]No agent found in pool default which satisfies the following demand: Agent.Version. All demands: msbuild, visualstudio, Agent.Version -gtVersion 3.218.0 The problem was caused by the SonarQubePrepare task he just added to his build pipeline: It still worked with an older SonarQubePrepare version however the task is marked as deprecated: ##[warning]This task is deprecated. Please upgrade to the latest version. For more information, refer to https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scanners/sonarqube-extension-for-azure-devops/ Updating a build agent I thought the fix would be easy; just update the outdated build agent(s). Therefore go to Project Settings –> Agent Pools . Click on the Agent pool which contains the agent you want to update:  On ...

SonarQube–Troubleshooting

After upgrading a SonarQube server at one of my clients, we encountered some issues. In this post I'll walk you through each problem we experienced and how we solved it. Let’s start! java.lang.IllegalStateException: Fail to connect to database Our first exception doesn’t tell that much. So let’s have a look at the logs: 2024.05.10 10:43:33 INFO  web[][o.s.p.ProcessEntryPoint] Starting Web Server 2024.05.10 10:43:33 INFO  web[][o.s.s.a.TomcatHttpConnectorFactory] Starting Tomcat on port 9000 2024.05.10 10:43:35 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 10.5.1.90531 / a69dd88808638ec33015277e236bca319314ce8b 2024.05.10 10:43:35 INFO  web[][o.s.d.DefaultDatabase] Create JDBC data source for jdbc:sqlserver://server:1433;databaseName=Tfs_Sonar;integratedSecurity=true 2024.05.10 10:43:35 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Starting... 2024.05.10 10:43:37 WARN  web[][o.s.c.a.AnnotationConfigApplicationContext] Except...

SonarQube on Windows Troubleshooting

After installing a new SonarQube version on one our Windows Server VM’s, I encountered some issues. Let me walk you through the problems I encountered and how I fixed them. Issue 1 -  java.lang.UnsupportedClassVersionError After I extracted the SonarQube binaries I opened the installation folder, went to the bin\windows-x86-64 folder and tried to run the startsonar.bat file. This failed with the following error message: D:\sonar\bin\windows-x86-64>startsonar Starting SonarQube... Error: LinkageError occurred while loading main class org.sonar.application.App         java.lang.UnsupportedClassVersionError: org/sonar/application/App 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 55.0 The error above is related to the class file version. Each JDK release comes with its class file version. Class files are backward comp...

Azure DevOps–SonarQube error

As part of our build pipelines, we run a code analysis through SonarQube. After moving SonarQube to a different server, our Azure DevOps pipelines started to fail. When I opened the build logs, I noticed the following error message: ERROR: JAVA_HOME exists but does not point to a valid Java home folder. No “bin\java.exe” file can be found there. I logged in on our SonarQube server and checked the value of the JAVA_HOME environment variable: JAVA_HOME = c:\program files\Zulu\zulu-11\bin\ Based on the error message above, it seems that the SonarScanner expects that we don’t include the ‘bin’ folder. So I updated the environment variable to: JAVA_HOME = c:\program files\Zulu\zulu-11 After rescheduling the build, the SonarQube analysis task completed succesfully.

SonarQube - SQL Server Integrated Security

While moving our build agents from one server to another, I also had to move our SonarQube instance. To install the SonarQube instance I followed the instructions mentioned here: https://docs.sonarqube.org/latest/setup/install-server/ As I was using SQL Server with Integrated Security, I took special attention when reading this section: To use integrated security: Download the Microsoft SQL JDBC Driver 9.2.0 package and copy mssql-jdbc_auth-9.2.0.x64.dll to any folder in your path. If you're running SonarQube as a Windows service, make sure the Windows account under which the service is running has permission to connect your SQL server. The account should have db_owner database role membership. If you're running the SonarQube server from a command prompt, the user under which the command prompt is running should have db_owner database role membership. Ensure that sonar.jdbc.username or sonar.jdbc.password properties are ...