SonarQubeCommunity / sonar-pdf-report

83 stars 81 forks source link

java.lang.NoSuchMethodError running on Sonar 5.5 #24

Open caseyscarborough opened 8 years ago

caseyscarborough commented 8 years ago

The following exception occurs at the end of the scan process when running on Sonar 5.5.

Exception in thread "main" java.lang.NoSuchMethodError: org.sonar.api.resources.Project.getConfiguration()Lorg/apache/commons/configuration/Configuration;
        at org.sonar.report.pdf.batch.PDFPostJob.shouldExecuteOnProject(PDFPostJob.java:57)
        at org.sonar.batch.bootstrap.BatchExtensionDictionnary.shouldKeep(BatchExtensionDictionnary.java:260)
        at org.sonar.batch.bootstrap.BatchExtensionDictionnary.getFilteredExtensions(BatchExtensionDictionnary.java:101)
        at org.sonar.batch.bootstrap.BatchExtensionDictionnary.select(BatchExtensionDictionnary.java:74)
        at org.sonar.batch.phases.PostJobsExecutor.execute(PostJobsExecutor.java:52)
        at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:87)
        at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:189)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
        at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:265)
        at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:260)
        at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:250)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
        at org.sonar.batch.scan.ProjectScanContainer.startComponents(ProjectScanContainer.java:128)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
        at org.sonar.batch.task.ScanTask.execute(ScanTask.java:55)
        at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
        at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:124)
        at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        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:240)
        at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
        at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:110)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:72)
        at org.sonarsource.scanner.cli.Main.main(Main.java:60)
vasuneet commented 8 years ago

any update on this ?

rfelgent commented 8 years ago

same problem here. using sonar 5.6.1.

romzeryan commented 8 years ago

I have the same problem with sonarqube 6.0 and PDF Report plugin 1.4. Stacktrace is exact as @caseyscarborough has posted.

532629 commented 7 years ago

I am also getting the same issue with sonarqube 6.0 and PDF Report plugin 1.4.

532629 commented 7 years ago

Details logs is:

Exception in thread "main" java.lang.NoSuchMethodError: org.sonar.api.resources.Project.getConfiguration()Lorg/apache/commons/configuration/Configuration; at org.sonar.report.pdf.batch.PDFPostJob.shouldExecuteOnProject(PDFPostJob.java:57) at org.sonar.scanner.bootstrap.BatchExtensionDictionnary.shouldKeep(BatchExtensionDictionnary.java:260) at org.sonar.scanner.bootstrap.BatchExtensionDictionnary.getFilteredExtensions(BatchExtensionDictionnary.java:101) at org.sonar.scanner.bootstrap.BatchExtensionDictionnary.select(BatchExtensionDictionnary.java:74) at org.sonar.scanner.phases.PostJobsExecutor.execute(PostJobsExecutor.java:50) at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:82) at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:184) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241) at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236) at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47) at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:115) at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:118) at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62) 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:233) at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151) at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:110) at org.sonarsource.scanner.cli.Main.execute(Main.java:74) at org.sonarsource.scanner.cli.Main.main(Main.java:61) Build was aborted

venkateshba commented 7 years ago

I am also getting the same issue with sonarqube 5.4 and PDF Report plugin 1.4.

designerferro commented 7 years ago

If we want to continue to use this, we will have to branch it and pickup where the original programmer left it. I found out that ComponentRoots from org.sonar.wsclient.issue.IssueQuery, wich exists on the sonar.api since version 3.6, no longer exists. Last version to implement it was api version 5.0. http://javadocs.sonarsource.org/5.0/apidocs/org/sonar/wsclient/issue/IssueQuery.html

This means, the objects the plugin is calling are not there to be called.

sobenavi commented 6 years ago

Hi I really want to export to PDF, i found this as key to solve the issue, we need to rewrite some code from original pdf-report lib, the error like says MacXatu is that org.sonar.api.resources.Project.getConfiguration()Lorg/apache/commons/configuration/Configuration doesn't exists more, was deprecated.... in documentation i found this:

api/resources deprecated Removed since 6.3, please use api/components and api/measures instead GET api/resources/index since 2.10 deprecated since 5.4

The web service is removed and you're invited to use the alternatives:

if you need one component without measures: api/components/show if you need one component with measures: api/measures/component if you need several components without measures: api/components/tree if you need several components with measures: api/measures/component_tree

rewrite org.sonar.api.resources.Project.getConfiguration() to one of the components below will fix it !!!

Who can help?