Unable to create new server connection using sonarlint (java.lang.NoClassDefFoundError: org/sonar/api/BatchExtension)

Unable to create new server connection using sonarlint

  • versions
    SonarQube : 6.7.6
    SonarLint for Eclipse:4.0.0.201810170711
    Eclipse:Eclipse Java EE IDE for Web Developers. Version: Oxygen.2 Release (4.7.2)Build id: 20171218-0600

  • error observed
    When trying to create a new connection and click ‘Finish’ at the end, nothing happens and I see the below error in the log (*though this works when connected to SonarQube 7.4 version)
    ‘’‘java.lang.NoClassDefFoundError: org/sonar/api/BatchExtension
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    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 java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    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.fis.ec.core.sonar.CustomRulesPlugin.define(CustomRulesPlugin.java:17)
    at org.sonarsource.sonarlint.core.container.global.ExtensionInstaller.install(ExtensionInstaller.java:62)
    at org.sonarsource.sonarlint.core.container.global.GlobalExtensionContainer.doBeforeStart(GlobalExtensionContainer.java:35)
    at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:123)
    at org.sonarsource.sonarlint.core.container.storage.StorageContainer.doAfterStart(StorageContainer.java:126)
    at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:125)
    at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.start(ConnectedSonarLintEngineImpl.java:118)
    at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.(ConnectedSonarLintEngineImpl.java:77)
    at org.sonarlint.eclipse.core.internal.server.Server.(Server.java:114)
    at org.sonarlint.eclipse.core.internal.server.ServersManager.create(ServersManager.java:432)
    at org.sonarlint.eclipse.ui.internal.server.wizard.ServerConnectionWizard.performFinish(ServerConnectionWizard.java:208)
    at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:778)
    at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:417)
    at org.eclipse.jface.dialogs.Dialog.lambda$0(Dialog.java:619)
    at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:81)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4428)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4238)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3817)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1039)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
    Caused by: java.lang.ClassNotFoundException: org.sonar.api.BatchExtension
    at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39)
    at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
    at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
    … 68 more’’’

  • steps to reproduce

    Install Sonar Lint
    In the Sonar Lint create new connection to Sonar Qube server
    Give relevant details and establish connection
    Error encountered

  • potential workaround
    Works when connected to 7.4 version of Sonar Qube

Hi,

Could you please list the plugins that you have installed in SonarQube (with their versions)?
You can get this information querying [sonarqube]/api/plugins/installed.
Thanks.

Hi - Please find the list

sonar-csharp-plugin-6.5.0.3766.jar
sonar-flex-plugin-2.3.jar
sonar-java-plugin-4.15.0.12310.jar
sonar-javascript-plugin-3.2.0.5506.jar
sonar-php-plugin-2.11.0.2485.jar
sonar-python-plugin-1.8.0.1496.jar
sonar-scm-git-plugin-1.3.0.869.jar
sonar-scm-svn-plugin-1.6.0.860.jar
sonar-typescript-plugin-1.1.0.1079.jar
sonar-xml-plugin-1.4.3.1027.jar
core-sonar-custom-rules-0.0.1-SNAPSHOT.jar

Thanks

Hi Senthil,

It looks like some plugins are too old and no longer compatible with the latest versions of SonarLint.
You should upgrade, in SonarQube, at least the following plugins:

  • sonar-java-plugin-4.15.0.12310.jar
  • sonar-python-plugin-1.8.0.1496.jar
  • sonar-php-plugin-2.11.0.2485.jar
  • sonar-javascript-plugin-3.2.0.5506.jar

You might have to upgrade other plugins too.

Hi - Thanks.

I’ll tried with upgrading SonarQube with latest sonar-java-plugin-5.8.0.15699.jar (which I’m interested) but it didn’t work.

Now I downgraded SonarLint for Eclipse from 4.0 to 3.6 and it works.

Thanks
Senthil