Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoSuchMethodError: org.sonar.plugins.surefire.api.SurefireUtils.getReportsDirectory #50

Closed
drewcrawford opened this issue Jan 26, 2014 · 7 comments
Assignees
Labels
Milestone

Comments

@drewcrawford
Copy link

I'm getting the behavior below once the reports are generated and during the sonar-runner analysis step:

02:20:07.407 INFO  - Sensor Objective-C SurefireSensor...
02:20:07.409 DEBUG - Release semaphore on project : org.sonar.api.resources.Project@3c0f3387[id=1,key=caffeine,qualifier=TRK], with key batch-caffeine
02:20:07.425 DEBUG - To prevent a memory leak, the JDBC Driver [org.postgresql.Driver] has been forcibly deregistered
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 5.800s
Final Memory: 5M/85M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
    at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
    at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
    at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
    at org.sonar.runner.api.Runner.execute(Runner.java:90)
    at org.sonar.runner.Main.executeTask(Main.java:70)
    at org.sonar.runner.Main.execute(Main.java:59)
    at org.sonar.runner.Main.main(Main.java:41)
Caused by: java.lang.NoSuchMethodError: org.sonar.plugins.surefire.api.SurefireUtils.getReportsDirectory(Lorg/sonar/api/resources/Project;)Ljava/io/File;
    at org.sonar.plugins.objectivec.tests.SurefireSensor.analyse(SurefireSensor.java:52)
    at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:72)
    at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:114)
    at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:150)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:211)
    at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:206)
    at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:199)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:58)
    at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
    at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:144)
    at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:132)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
    at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:45)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
    ... 9 more

SonarQube 4.1
ObjC plugin 0.3.1

Some other background information:

$ ls -l sonar-reports/
total 744
-rw-r--r--+ 1 drew  staff     842 Jan 26 02:05 TEST-report.xml
-rw-r--r--+ 1 drew  staff  366938 Jan 26 02:06 coverage-caffeine-ios.xml
-rw-r--r--+ 1 drew  staff    5164 Jan 26 02:06 oclint.xml

$ cat sonar-project.properties | grep junit
sonar.junit.reportsPath=sonar-reports/
@jimrutherford
Copy link

I am getting the exact same error - SonarQube 4.1 and ObjC plugin 0.3.1

@cyrilpicat
Copy link
Contributor

thanks.

This one seems a bit trickier. I might get back to you if I am not able to understand it as is.

@drewcrawford
Copy link
Author

If you anticipate reproducing to be a problem, I can take a look at it since I can reproduce it easily and it's medium-priority for me, and I know a little Java. I would need a little bit of background information on how this is expected to work however.

If you look over here the method referenced in the error is indeed present, although I'm a bit mystified how this class (which is on the server) ends up inside sonar-runner on a different machine. But there must be some mechanism, or otherwise I would expect java.lang.NoSuchClassError and what is observed is java.lang.NoSuchMethodError.

If I could get some more information on how this copy operation works or some debugging mechanism to see what the class looks like when it is on the sonar-runner side I could dig further.

@drewcrawford
Copy link
Author

@jimrutherford are you running the server on OSX?

I originally got this behavior running sonarqube on localhost on my Mac. However after moving to the production environment, I can no longer reproduce. Could be OS-specific, or localhost-specific.

@drewcrawford
Copy link
Author

This issue is related to installing the Java plugin. Reproduction steps:

  1. Get into this configuration:
  • SonarQube Version 4.1.1
  • Java plugin 2.0
  • ObjC plugin 0.3.1
  • sonar-runner 2.3
  1. Analyze any project

What is going on here is that the SurefireUtils API is different depending on whether or not the Java plugin is installed. The reference commit addresses this issue and is included in PR #53.

@cyrilpicat
Copy link
Contributor

thanks for this investigation!

cyrilpicat added a commit that referenced this issue Feb 21, 2014
…report path, avoiding one more parameter in sonar-project.properties
@cyrilpicat cyrilpicat added the bug label Feb 21, 2014
@cyrilpicat cyrilpicat added this to the 0.3.2 milestone Feb 21, 2014
@cyrilpicat cyrilpicat self-assigned this Feb 21, 2014
@cyrilpicat
Copy link
Contributor

This was clearly due to the 4.1 update. I confirm you that the java plugin should be optional and with this fix it works with and without the plugin in my case, and on 3.7.x and 4.x versions.

I have integrated your fix + improved the configuration of the plugin by making parameter 'sonar.junit.reportsPath' optional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants