Urgent Help Needed - Sonarqube errors after upgrading to version 7.1

Hi All,

We recently upgraded from SonarQube Community Edition 5.6.3 to 7.1 and are running into an issue on one of our servers. We performed the database upgrade (it took about 11 hours) and afterwards SonarQube is up and available. We can login, see our projects, etc…

But our jobs that send data to SonarQube are failing for this server with the following error:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.5.0.1254:sonar (default-cli) on project dp-easyurl: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.5.0.1254:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.5.0.1254:sonar: java.lang.NoSuchMethodError: org.sonar.api.resources.Project.getSettings()Lorg/sonar/api/config/Settings;

The interesting thing is we have the same scenario (upgraded from 5.6.3 to 7.1) and the same plugins installed on other SonarQube servers without the issue. We have several mirrored environments and the problem is only happening on this one server. There is substantially more data on the SonarQube server, but other than that there’s no difference between the one’s that are working and this one.

Here are the list of plugins and versions we have installed

  • Android 1.1
  • Checkmarx 7.2.2-3.2.6
  • Checkstyle 2.4
  • Clover 3.1
  • Cobertura 2.0
  • GitHub 1.3
  • LDAP 1.4
  • PMD 2.4
  • SonarJS 5.2 (build 13398)
  • Timeline 1.5

I confirmed the database upgrade completed successfully and don’t see any errors in our SonarQube logs. I have restarted SonarQube several times, but no luck.

Any ideas?

Here’s the full stack trace with maven debug output enabled:

10:01:12 Caused by: java.lang.NoSuchMethodError: org.sonar.api.resources.Project.getSettings()Lorg/sonar/api/config/Settings;
  10:01:12 at org.sonar.java.api.JavaUtils.getSourceVersion(JavaUtils.java:83)
  10:01:12 at org.sonar.plugins.pmd.PmdExecutor.createPmdTemplate(PmdExecutor.java:142)
  10:01:12 at org.sonar.plugins.pmd.PmdExecutor.executePmd(PmdExecutor.java:90)
 
  10:01:12 at org.sonar.plugins.pmd.PmdExecutor.execute(PmdExecutor.java:76)
  10:01:12 at org.sonar.plugins.pmd.PmdSensor.analyse(PmdSensor.java:67)
  10:01:12 at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
  10:01:12 at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
  10:01:12 at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)
  10:01:12 at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
  10:01:12 at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:180)
  10:01:12 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
  10:01:12 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
  10:01:12 at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:302)
  10:01:12 at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:297)
  10:01:12 at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:271)
  10:01:12 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
  10:01:12 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
  10:01:12 at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
  10:01:12 at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
  10:01:12 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
  10:01:12 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
  10:01:12 at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
  10:01:12 at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
  10:01:12 at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
  10:01:12 at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
  10:01:12 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  10:01:12 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  10:01:12 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  10:01:12 at java.lang.reflect.Method.invoke(Method.java:498)
  10:01:12 at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
  10:01:12 at com.sun.proxy.$Proxy16.execute(Unknown Source)
  10:01:12 at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171)
  10:01:12 at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
  10:01:12 at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:65)
  10:01:12 at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:104)
  10:01:12 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)

Error seems to be coming from PMD plugin. Can you check if the same version is installed on other servers? You can also try to remove it to see if it fixes the issue.

Thanks Tibor. We concluded the same. We do have the same PMD plugin version on our other SonarQube servers without any issues. Uninstalling and reinstalling the PMD plugin fixed the issue - not sure why though.

-Mike

That’s bit strange, I don’t see how reinstalling the plugin could change anything. Unfortunately PMD plugin doesn’t seem to be actively maintained, so it’s likely you will face such issues with future upgrades. You can consider using SonarJava and either import the issues from PMD and Checkstyle reports (new feature since 5.6) or use SonarJava rules.

1 Like