Gradle
  1. Gradle
  2. GRADLE-2011

ClassNotFoundException when running SonarAnalyze

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Resolution: Unresolved
    • Affects Version/s: 1.0-milestone-6
    • Fix Version/s: None

      Description

      Reported by Matthew and Erik Weibust.

      When running SonarAnalyze, some people got the following exception. Further details:

      • Sonar 2.11
      • Clean Mac Lion install without an installed Gradle for some people (using the wrapper)
      • Gradle Milestone 6 being used by everyone
      • Problem exhibited on Windows and Mac
      • Mac latest JDK for some people
      • No daemon

      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
      

        Activity

        Hide
        Peter Niederwieser
        added a comment -

        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?

        Show
        Peter Niederwieser
        added a comment - 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?
        Hide
        Matthew J. McCullough
        added a comment -

        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.

        Show
        Matthew J. McCullough
        added a comment - 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.
        Hide
        Erik Weibust
        added a comment -

        Still having the same problem. I'm attaching the stack trace. Please let me know what else I can provide.

        Erik

        Show
        Erik Weibust
        added a comment - Still having the same problem. I'm attaching the stack trace. Please let me know what else I can provide. Erik
        Hide
        Erik Weibust
        added a comment -

        Stack trace for the specifics on this ticket.

        Show
        Erik Weibust
        added a comment - Stack trace for the specifics on this ticket.
        Hide
        Peter Niederwieser
        added a comment -

        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.

        Show
        Peter Niederwieser
        added a comment - 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.
        Hide
        Peter Niederwieser
        added a comment -

        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?

        Show
        Peter Niederwieser
        added a comment - 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?
        Hide
        Erik Weibust
        added a comment -

        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.

        Show
        Erik Weibust
        added a comment - 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.
        Hide
        Erik Weibust
        added a comment -

        Attempting from home network and getting same stack trace.

        Show
        Erik Weibust
        added a comment - Attempting from home network and getting same stack trace.
        Hide
        Peter Niederwieser
        added a comment -

        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.

        Show
        Peter Niederwieser
        added a comment - 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.

          People

          • Assignee:
            Unassigned
            Reporter:
            Peter Niederwieser
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: