java.lang.NoClassDefFoundError: org/sonar/plugins/java/api/CheckRegistrar
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:550)
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 org.sonar.classloader.ClassRealm.loadClassFromSelf(ClassRealm.java:125)
at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:37)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
at com.fidelity.fpcms.sonar.MyJavaRulesPlugin.define(MyJavaRulesPlugin.java:36)
at o.ss.sl.core.container.global.ExtensionInstaller.install(ExtensionInstaller.java:72)
at o.ss.sl.core.container.global.ExtensionInstaller.install(ExtensionInstaller.java:62)
at o.ss.sl.core.container.global.GlobalExtensionContainer.doBeforeStart(GlobalExtensionContainer.java:36)
at o.ss.sl.core.container.ComponentContainer.startComponents(ComponentContainer.java:124)
at o.ss.sl.core.container.storage.StorageContainer.doAfterStart(StorageContainer.java:161)
It seems you have a custom plugin implementing some Java rules on your SonarQube server. This is normally supported, but here I guess you might have an outdated version of the Java analyzer, no more supported by SonarLint.
To verify that, could you please open in a web browser the page: https://<your sonarqube server>/api/plugins/installed and post the result here.
I was able to disable bindings via editing sonarSettings.xml. That allowed me to bring up the SonarLint binding dialog when I started IntelliJ (toggling on/off updated that setting). The same exception occurs with bindings disabled. For reference, current sonarSettings.xml:
This file (sonarSettings.xml) and those settings (localAnalysisScripName, useAlternativeWorkingDir, …) are not part of the official SonarLint plugin. It seems they come from a plugin named “SonarQube Analyzer” that is not supported by SonarSource.
I suggest you remove this plugin, and ensure you are using an official SonarLint build.
The SonarLint settings file where the binding configuration is stored is named sonarlint.xml.
I removed both the SonarLint and SonarQube plugins, restarted IntelliJ, rm -rf .idea/sonar* (in my project), installed the SonarLint plugin, restarted IntelliJ…
As a followup, could this be the root cause? Before clicking on “Open SonarLint Settings” link, it has the following in the popup:
SonarLint failed to analyze TypeScript code
SonarLint requires Node.js runtime version 10.12.0 or later to analyze TypeScript code.
Please configure the Node.js path in the SonarLint settings.
Open SonarLint Settings
If so, is there a way to add that in an xml? FWIW, no sonarlint.xml nor sonarSettings.xml since I did the clean install this morning…
Then if you still see the exact same stacktrace as you reported in the first post, it means SonarLint is still in connected mode (using the cached data from a SonarQube server).
Try to open a brand new project since the binding settings are stored in project settings.