Analysis failed. SonarQube is unable to analyze file

  • Versions tested: SonarLint 1.15.0 + VS Code 1.43.2
  • error observed:

Analyzing file ‘file:///c%3A/folder/’…
Analysis failed. SonarQube is unable to analyze file : ‘c:\folder\’

I can’t make sonarlint work properly with my Java files in VS code. Any help would be appreciate :slight_smile:

I have doubled checked my configuration. Sonarlint works perfectly with my TypeScript and HTML files but not Java ones. Thanks

Hello, thanks for reporting this.

Could your please enable both “Show Analyzer Logs” and “Show Verbose Logs” (see FAQ) and paste any message / stack trace that arises? And if possible, could you please post relevant source code to reproduce the issue?

Also, support for Java in SonarLint requires version 0.56.0 of the Java Language extension, you might want to check that your extensions are up-to-date.

Hi Jean-Baptiste,
Thanks for your support.
This is a sample java file that fails (where xxx is my company and yyy my application):

import org.springframework.stereotype.Repository;
public interface HomepageNotificationRepository extends PagingAndSortingRepository<HomepageNotification, String>{

This is a full stack for this file:

The Language support for Java extension in my VS Code is version 0.59.0

Hey, thanks for the detailed report! I see in the analysis logs that you are using connected mode, which version of the Java analyzer is installed on the server side? This information should be logged when the SonarLint language server starts in VSCode, something like:

[Debug - 14:35:22.753] Starting connected SonarLint engine for 'connectionId'...
[Debug - 14:35:23.123] Create : /home/user/.sonarlint/plugins
[Debug - 14:35:23.124] Plugin cache: /home/user/.sonarlint/plugins
[Debug - 14:35:23.125] Create : /home/user/.sonarlint/plugins/_tmp
[Debug - 14:35:23.186] Load plugins
[Debug - 14:35:23.535] Load plugins (done) | time=349ms
[Debug - 14:35:23.733] Plugins:
[Debug - 14:35:23.734]   * SonarPython (python)
[Debug - 14:35:23.734]   * SonarJava (java)    <= Java version here
[Debug - 14:35:23.734]   * SonarHTML (web)
[Debug - 14:35:23.734]   * SonarPHP (php)
[Debug - 14:35:23.735]   * SonarTS (typescript)
[Debug - 14:35:23.735]   * SonarJS (javascript)
[Info  - 14:35:23.742] Using storage for server 'connectionId' (last update 29/01/2020 14:34)

Please make sure that your binding is up-to-date beforehand, using VSCode command “SonarLint: Update all project bindings to SonarQube/SonarCloud”.

this is the output of sonarlint start:

[Debug - 17:08:26.296] Default settings updated: WorkspaceFolderSettings[analyzerProperties={},testFilePattern=,connectionId=SonarQube,projectKey=APP_UI]
[Debug - 17:08:26.305] Starting connected SonarLint engine for 'SonarQube'...
[Debug - 17:08:27.881] Create : C:\Users\xxx\.sonarlint\plugins
[Debug - 17:08:27.882] Plugin cache: C:\Users\xxx\.sonarlint\plugins
[Debug - 17:08:27.883] Create : C:\Users\xxx\.sonarlint\plugins\_tmp
[Debug - 17:08:27.956] Load plugins
[Debug - 17:08:28.177] Load plugins (done) | time=220ms
[Debug - 17:08:28.396] Plugins:
[Debug - 17:08:28.397]   * License for SonarLint 7.7 (license)
[Debug - 17:08:28.397]   * SonarPython (python)
[Debug - 17:08:28.398]   * SonarJava (java)
[Debug - 17:08:28.398]   * SonarHTML (web)
[Debug - 17:08:28.398]   * SonarPHP (php)
[Debug - 17:08:28.399]   * SonarTS (typescript)
[Debug - 17:08:28.399]   * SonarApex (sonarapex)
[Debug - 17:08:28.400]   * SonarJS (javascript)
[Debug - 17:08:28.400]   * SonarPLSQL (plsql)
[Info  - 17:08:28.410] Using storage for server 'SonarQube' (last update 26/03/20 16:43)

thanks again for your help

Hi @bnts43

I managed to reproduced and even found the root cause of the issue. I created a ticket so that we can fix the issue during the next sprint:

In the meantime, you can stop using connected mode, or update the Java analyzer on your SonarQube server to a more recent version (the one you are using is pretty old now).

Many thanks for reporting the issue!

Great! Ouaw! What a fast fix it will be!
Thank you :slight_smile:
Actually, the version of SonarQube is managed by another team I don’t know.

I’ll wait for your fix then :wink:

Thanks again!