Trying to save symbol table twice for the same file is not supported

  • We are you using Sonarqube LTS version 7.9.2.30863 on Java 11 JDK, Oracle Database 12c Enterprise Edition Release 12.1.0.2, Sonarqube Scanner 4.2.0.1873, Jenkins 2.138.3 .

  • We are trying to integrate Sonarqube with Jenkins in order to analyse our code every time a new change is checked in.

  • what have you tried so far to achieve this: we based our setup on the official installation guides however the Jenkins job fails during scanning with the following exception:

ERROR: Error during SonarQube Scanner execution
org.sonar.java.AnalysisException: SonarQube is unable to analyze file : 'checkout/uep-all/uep-game-external/src/main/uep/game/external/ExternalPartnerJobConfig.java'
        at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:99)
        at org.sonar.java.ast.JavaAstScanner.scan(JavaAstScanner.java:67)
        at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:115)
        at org.sonar.java.JavaSquid.scan(JavaSquid.java:109)
        at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:88)
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
        at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
        at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:400)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:395)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:392)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
        at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
        at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        at com.sun.proxy.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.UnsupportedOperationException: Trying to save symbol table twice for the same file is not supported: checkout/uep-all/uep-game-external/src/main/uep/game/external/ExternalPartnerJobConfig.java
        at org.sonar.scanner.sensor.DefaultSensorStorage.store(DefaultSensorStorage.java:296)
        at org.sonar.api.batch.sensor.symbol.internal.DefaultSymbolTable.doSave(DefaultSymbolTable.java:142)
        at org.sonar.api.batch.sensor.internal.DefaultStorable.save(DefaultStorable.java:45)
        at org.sonar.java.ast.visitors.SonarSymbolTableVisitor.visitCompilationUnit(SonarSymbolTableVisitor.java:61)
        at org.sonar.java.model.VisitorsBridge.createSonarSymbolTable(VisitorsBridge.java:221)
        at org.sonar.java.model.VisitorsBridge.visitFile(VisitorsBridge.java:129)
        at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:90)
        ... 35 more

Any ideas how we can fix this ?

Thanks,
Elena

Hi Elena,

Would you mind checking what version of the Java analyzer you’re running? You can find it in Administration->Marketplace. Specifically, I’m interested in whether you’re still on the 5.x version that shipped with SonarQube 7.9.2 or have upgraded to a 6.x version.

 
Thx,
Ann

Hi Ann,

Thank you for the quick reply, it was a really nice surprise to hear from you so soon.

Br,

Elena

Hi Elena,

From the message you’re getting, it sounds like you may be facing a configuration error that somehow causes the same file to be analyzed twice. You should double-check your sonar.sources configuration.

At the same time, you’re on an old version of the analyzer. Newer versions are far more accurate. You should consider upgrading - although it’s not likely to have an impact on this particular problem.

 
Ann