[GRADLE-2011] ClassNotFoundException when running SonarAnalyze Created: 21/Dec/11 Updated: 30/Apr/15 Resolved: 30/Apr/15 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | 1.0-milestone-6 |
Fix Version/s: | None |
Type: | Bug | ||
Reporter: | Peter Niederwieser | Assignee: | Luke Daley |
Resolution: | Won't Fix | Votes: | 1 |
Attachments: | gradle-sonar-java-build-file.zip sonar-gradle-error.txt sonar-gradle-error_12_23_2011.txt |
Description |
Reported by Matthew and Erik Weibust. When running SonarAnalyze, some people got the following exception. Further details:
See attachment for analyzed project. $ ./gradlew sonar -S > error.txt FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':sonarAnalyze'. Cause: org.gradle.api.plugins.sonar.internal.SonarCodeAnalyzer * Try: Run with --info or --debug option to get more log output. * Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':sonarAnalyze'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:71) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:48) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42) at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:243) at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192) at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177) at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70) at org.gradle.execution.DefaultBuildExecuter.access$300(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:80) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:63) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:157) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80) at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42) at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28) at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:32) at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:21) at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:233) at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:217) at org.gradle.launcher.Main.doAction(Main.java:48) at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:53) at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:51) at org.gradle.launcher.exec.Execution.execute(Execution.java:28) at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:39) at org.gradle.launcher.Main.main(Main.java:39) 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.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:51) at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:33) at org.gradle.launcher.GradleMain.main(GradleMain.java:24) 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.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:124) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:53) Caused by: java.lang.ClassNotFoundException: org.gradle.api.plugins.sonar.internal.SonarCodeAnalyzer at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at org.sonar.batch.bootstrapper.BootstrapClassLoader.findClass(BootstrapClassLoader.java:52) at org.sonar.batch.bootstrapper.BootstrapClassLoader.loadClass(BootstrapClassLoader.java:86) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at java_lang_ClassLoader$loadClass.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.gradle.api.plugins.sonar.SonarAnalyze.analyze(SonarAnalyze.groovy: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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1054) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:884) at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:158) at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:93) at org.gradle.api.plugins.sonar.SonarAnalyze_Decorated.invokeMethod(Unknown Source) at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:55) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120) at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$2.execute(AnnotationProcessingTaskFactory.java:129) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$2.execute(AnnotationProcessingTaskFactory.java:127) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:63) ... 48 more |
Comments |
Comment by Peter Niederwieser [ 21/Dec/11 ] |
So far I haven't been able to reproduce this. Tried with Sonar 2.11 and 2.12, the attached project and the Spock project, with and w/o daemon, with and w/o wrapper. Always worked as expected for me. Mac OS 10.6.8, latest (Mac) JDK 6. Matthew, did you ever see this problem on your own machine? Any further hints you can think of? |
Comment by Matthew J. McCullough [ 21/Dec/11 ] |
Never did see it on my machine, but did on four student machines at Rich Web. Our best hope is to reach out to Erik Weibust since he had a pristine machine and was able to reliably reproduce it. I'll add him and ask for his input. |
Comment by Erik Weibust [ 22/Dec/11 ] |
Still having the same problem. I'm attaching the stack trace. Please let me know what else I can provide. Erik |
Comment by Erik Weibust [ 22/Dec/11 ] |
Stack trace for the specifics on this ticket. |
Comment by Peter Niederwieser [ 22/Dec/11 ] |
This stack trace is different, and I think I know what's going on. The Sonar client library used by the SonarAnalyze task tries to bootstrap itself by downloading files from the Sonar server, but something (probably your OS firewall) is preventing it from doing so. |
Comment by Peter Niederwieser [ 22/Dec/11 ] |
Maybe the original stack trace is a consecutive error happening on subsequent runs? Can you confirm that, or do you always get the stack trace you just posted? |
Comment by Erik Weibust [ 23/Dec/11 ] |
Well, I tried again and get the same "Connection refused" error I was getting yesterday. Today I'm trying from my home network. Yesterday I was attempting while at work. I'm not sure if that matters. I also noticed the error message was slightly different when trying in Florida at RWX. |
Comment by Erik Weibust [ 23/Dec/11 ] |
Attempting from home network and getting same stack trace. |
Comment by Peter Niederwieser [ 13/Jan/12 ] |
If it's not a personal firewall issue, maybe you have started the Sonar server on a different port? In that case you'll have to configure sonar.server.url accordingly. Can you try to set this property to the same URL that you use in the browser to access the Sonar web interface? This definitely looks like an environment issue to me. |
Comment by Luke Daley [ 30/Apr/15 ] |
The way forward is the "sonar-runner" plugin (https://gradle.org/docs/current/userguide/sonar_runner_plugin.html) which supersedes the "sonar" plugin. If your issue still persists with the "sonar-runner" plugin, please raise a new issue via https://discuss.gradle.org/c/bugs. |