[sonarlint-analysis-engine] ERROR sonarlint - ECJ: Unable to parse file

  • Operating system (Host): Microsoft Windows 10 Enterprise / Version 10.0.19045 Build 19045
  • WSL : Ubuntu 22.04.3 LTS / Release: 22.04
  • SonarLint plugin version: 10.9.0.79423
  • IntelliJ version: 2024.2.0.2 (Ultimate Edition)
  • Programming language you’re coding in: Java / JS
  • Is connected mode used: No (planning to use connected mode)

My cloned code and local server are in WSL, IntelliJ is able to read my code from the WSL, but for some reason, when I try to analyse an individual file, I receive the error below. For JavaScript files, I don’t get this error, but I don’t get any results.

[2024-09-24T12:20:31.099] [sonarlint-analysis-engine] ERROR sonarlint - ECJ: Unable to parse file
 [2024-09-24T12:20:31.1] [sonarlint-analysis-engine] ERROR sonarlint - Unable to parse source file : '[uri=file:////wsl$/Ubuntu/home/user-folder/projects/qwerty/repo/folder1/bin/custom/folder2/folder3/src/com/qqq/www/integrations/service/impl/QwertyIntegrationServiceImpl.java]'
 [2024-09-24T12:20:31.1] [sonarlint-analysis-engine] ERROR sonarlint - ECJ: Unable to parse file.

Also getting this message :

 [2024-09-24T14:37:35.501] [SonarLint Server RPC request executor] WARN sonarlint - Node.js could not be automatically detected, has to be configured manually in the SonarLint preferences!

image
image
image

Hi,

Welcome to the community!

Would you be comfortable sharing that file publicly? Privately?

 
Thx,
Ann

Hi, I could share it privately, but that’s happening for simple files as well, the files are in the WSL, so I feel it’s something related to that. Please, let me know how you want to move forward.

Hi,

Before we go down that road, we’ve just released 10.10. I don’t think it will solve this, but could you double-check, please?

 
Thx,
Ann

Hi Ann,

I have updated to the latest sonarlint for intellij and still having issues with my project. I have created a simple project with a java file and sonarlint worked fine. However, with my main project, which is a monolith code base (sap commerce-hybris), with java and web files, it doesn’t work, same error for Java files, and for JS I’m getting errors and exceptions.

My team is actually trying to evaluate SonarLint with the connected mode, but since it doesn’t work with an “offline” mode, we can’t move forward to the connected mode.

Please, let me know what else could I try, some settings or properties in IntelliJ specific to SonarLint or something like that.

Many Thanks!

Hi,

Thanks for checking. I’m going to flag this for the language team since this seems to be related specifically to Java files. Yes, I know you mentioned JS too, but I suspect we have multiple things going on here. So let’s start with Java & see where that gets us.

 
Ann

1 Like

Hey @brilliant-dolby, I apologize for asking again, but could you try again with the latest version, 10.11? We fixed some issues regarding the loading of Node.js in some specific scenarios.

I do not necessarily expect the issue to be fixed based on what you said, so could you also please share the SonarLint logs with us?

Thank you!

1 Like

Hi @nicolas.quinquenel, I have updated the version, still no luck. Please, let me know how can I privately share the logs with you and also where can I find these logs file or would it be just a copy/paste of what I have in IntelliJ console. Many Thanks!

Hey @brilliant-dolby, you should be able to share the logs on the following link safely:

https://sonarsource.app.box.com/f/6decfa83022245a283763c4ad0974424

It will be accessible only by a few SonarSourcers.

You can simply copy/paste the content of the SonarLint log tab. Thank you!

Hi @nicolas.quinquenel , I uploaded a couple files, hope it will help you guys find the issue! Let me know if I can help further!

Thank you, @brilliant-dolby; just to keep you updated, I received the logs and am continuing the investigation. I’m able to analyze Java files on WSL2, so I’m still unsure about the root cause of your issue.

1 Like

Regarding the Node.js issue, we do not support running a Linux binary on Windows. Could you try setting a Node.js installed on your Windows or your WSL environment? For example, you could simply extract the Windows binary in the WSL environment and use it within SonarLint. Also, please restart SonarLint if you change your Node.js version to ensure it has been taken into account.

Hey @brilliant-dolby,
I am trying to understand the issue on the Java side, and I have a couple of questions.

  1. What is the size of the file you are trying to analyze (both in terms of LoC and size on disk)? From what I am reading in the logs, I see that the file takes a few seconds (3 to 4 seconds) to fail before parsing.
  2. Are you using Java preview features? The analysis seems to be targeting Java 17, and I would like to clarify whether preview features may be interfering with the parsing.

Cheers,

Dorian

Thanks, I think I have said that, yes, with a simple java project the sonarlint is working fine. The problem is that when I load my work project, which is a large code base, I get this error, ECJ : Unable to parse file.

The project has many many files. Just as example :

  • Loc : 505 / Size : 17.4 KB (17,895 bytes)

  • LoC : 4313 / 154 KB (158,009 bytes)

  • I’m not using this Java Preview.

Could it be some conflict with another plugin? For this project, I use this SAP-Commerce-Developers-Toolset EPAM Systems.

Hi @Dorian_Burihabwa / @nicolas.quinquenel / @ganncamp , just as an update, I have created a new project with the same code base but without using the plugin SAP-Commerce-Developers-Toolset EPAM Systems and the SonarLint worked without giving me the error. There might be some conflict, restriction or settings on this plugin that is causing this issue. I also use the jRebel plugin and both are MUST-have for SAP Commerce projects.

1 Like

Hi @Dorian_Burihabwa / @nicolas.quinquenel , it looks like the SAP Commerce Tool plugin is not all at fault. After trying not to use the plugin, I’m still facing the error for some files.

Is there any willingness to dig more into this?

  • Failed File Details : 154KB / 4298 LoC

  • Working File Details : 54KB / 1362 LoC

  • Looks like some preview features are getting used somehow

image


Hey @brilliant-dolby,
Thank you for coming back to the topic. Unfortunately, it is going to be difficult for me to investigate the Java issue further without the file or a code sample that would trigger the issue.

Would it be possible for you to share that file with us using the link shared above?

Thanks in advance.

Dorian