Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-8327

A Hudson execution of maven sonar:sonar on a slave causes a class cast exception for org.dom4j.DocumentFactory

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Component/s: sonar, ssh-slaves-plugin
    • Labels:
      None
    • Environment:
      Hudson 1.389 on Windows

      Description

      {{Started by user anonymous
      Building remotely on Dev-Build3
      Updating http://code/sw/iE2/trunk/iBO-iE2
      At revision 23722
      no change for http://code/sw/iE2/trunk/iBO-iE2 since the previous build
      No emails were triggered.
      Parsing POMs
      [iBO-iE2] $ "C:\Program Files\Java\jdk1.6.0_20/bin/java" -Xmx512m -XX:MaxPermSize=128m -Dmaven.test.failure.ignore=false -cp "C:\HudsonHome\Slave1\maven-agent.jar;C:\Program Files\apache-maven-2.2.1\boot\classworlds-1.1.jar" hudson.maven.agent.Main "C:\Program Files\apache-maven-2.2.1" C:\HudsonHome\Slave1\slave.jar C:\HudsonHome\Slave1\maven-interceptor.jar 58208 C:\HudsonHome\Slave1\maven2.1-interceptor.jar
      <===[HUDSON REMOTING CAPACITY]===>���channel started
      Executing Maven: -B -f C:\HudsonHome\Slave1\workspace\iBO-iE2\iBO-iE2\pom.xml clean -X -U -e org.codehaus.mojo:sonar-maven-plugin:1.0-beta-2:sonar
      + Error stacktraces are turned on.
      Apache Maven 2.2.1 (r801777; 2009-08-07 07:16:01+1200)
      Java version: 1.6.0_20
      }}
      ...

      {{Results :

      Tests run: 73, Failures: 0, Errors: 0, Skipped: 0

      Flushing results...
      Flushing results done
      Cobertura: Loaded information on 330 classes.
      Cobertura: Saved information on 330 classes.
      [HUDSON] Recording test results
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Can not execute Sonar

      Embedded error: Unable to execute maven plugin
      org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
      [INFO] ------------------------------------------------------------------------
      [DEBUG] Trace
      org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute Sonar
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
      at org.apache.maven.lifecycle.LifecycleExecutorInterceptor.execute(LifecycleExecutorInterceptor.java:65)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
      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.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at hudson.maven.agent.Main.launch(Main.java:165)
      at hudson.maven.MavenBuilder.call(MavenBuilder.java:165)
      at hudson.maven.MavenModuleSetBuild$Builder.call(MavenModuleSetBuild.java:744)
      at hudson.maven.MavenModuleSetBuild$Builder.call(MavenModuleSetBuild.java:688)
      at hudson.remoting.UserRequest.perform(UserRequest.java:114)
      at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      at hudson.remoting.Request$2.run(Request.java:270)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
      at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:103)
      at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:79)
      at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:88)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
      at hudson.maven.agent.PluginManagerInterceptor.executeMojo(PluginManagerInterceptor.java:182)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
      ... 28 more
      Caused by: org.sonar.api.utils.SonarException: Unable to execute maven plugin
      at org.sonar.maven.Maven2PluginExecutor.execute(Maven2PluginExecutor.java:67)
      at org.sonar.maven.Maven2PluginExecutor.execute(Maven2PluginExecutor.java:46)
      at org.sonar.batch.SensorsExecutor.executeMavenPlugin(SensorsExecutor.java:69)
      at org.sonar.batch.SensorsExecutor.execute(SensorsExecutor.java:55)
      at org.sonar.batch.ProjectBatch.execute(ProjectBatch.java:59)
      at org.sonar.batch.Batch.analyzeProject(Batch.java:120)
      at org.sonar.batch.Batch.analyzeProjects(Batch.java:83)
      at org.sonar.batch.Batch.execute(Batch.java:58)
      at org.sonar.maven.SonarMojo.executeBatch(SonarMojo.java:142)
      at org.sonar.maven.SonarMojo.execute(SonarMojo.java:133)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
      at hudson.maven.agent.PluginManagerInterceptor.executeMojo(PluginManagerInterceptor.java:182)
      at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:98)
      ... 33 more
      Caused by: org.apache.maven.lifecycle.LifecycleExecutionException: Internal error in the plugin manager executing goal 'org.apache.maven.plugins:maven-surefire-plugin:2.4.3:test': Failed to read C:\HudsonHome\Slave1\workspace\iBO-iE2\iBO-iE2\target\surefire-reports\TEST-com.energyintellect.TestDateHelperCheckTimeAlign.xml
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:698)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:1205)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:1038)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:643)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
      at org.apache.maven.lifecycle.LifecycleExecutorInterceptor.execute(LifecycleExecutorInterceptor.java:65)
      at org.sonar.maven.Maven2PluginExecutor.execute(Maven2PluginExecutor.java:64)
      ... 45 more
      Caused by: org.apache.maven.plugin.PluginManagerException: Failed to read C:\HudsonHome\Slave1\workspace\iBO-iE2\iBO-iE2\target\surefire-reports\TEST-com.energyintellect.TestDateHelperCheckTimeAlign.xml
      at hudson.maven.agent.PluginManagerInterceptor.executeMojo(PluginManagerInterceptor.java:196)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
      ... 56 more
      Caused by: hudson.util.IOException2: Failed to read C:\HudsonHome\Slave1\workspace\iBO-iE2\iBO-iE2\target\surefire-reports\TEST-com.energyintellect.TestDateHelperCheckTimeAlign.xml
      at hudson.tasks.junit.TestResult.parse(TestResult.java:214)
      at hudson.tasks.junit.TestResult.parse(TestResult.java:155)
      at hudson.maven.reporters.SurefireArchiver.postExecute(SurefireArchiver.java:108)
      at hudson.maven.MavenModuleSetBuild$Builder.postExecute(MavenModuleSetBuild.java:822)
      at hudson.maven.MavenBuilder$Adapter.postExecute(MavenBuilder.java:300)
      at hudson.maven.agent.PluginManagerInterceptor$1MojoIntercepterImpl.callPost(PluginManagerInterceptor.java:170)
      at hudson.maven.agent.PluginManagerInterceptor.executeMojo(PluginManagerInterceptor.java:183)
      ... 57 more
      Caused by: org.dom4j.DocumentException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory Nested exception: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
      at org.dom4j.io.SAXReader.read(SAXReader.java:484)
      at org.dom4j.io.SAXReader.read(SAXReader.java:264)
      at hudson.tasks.junit.SuiteResult.parse(SuiteResult.java:99)
      at hudson.tasks.junit.TestResult.parse(TestResult.java:199)
      ... 63 more
      Caused by: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
      at org.dom4j.DocumentFactory.getInstance(DocumentFactory.java:97)
      at org.dom4j.io.SAXReader.getDocumentFactory(SAXReader.java:645)
      at org.dom4j.io.SAXReader.createContentHandler(SAXReader.java:969)
      at org.dom4j.io.SAXReader.read(SAXReader.java:449)
      ... 66 more
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 2 minutes 14 seconds
      [INFO] Finished at: Fri Dec 17 14:34:07 GMT+12:00 2010
      [INFO] Final Memory: 51M/167M
      [INFO] ------------------------------------------------------------------------
      Waiting for Hudson to finish collecting data
      channel stopped
      [WARNINGS] Skipping publisher since build result is FAILURE
      Email was triggered for: Failure
      Email was triggered for: Still Failing
      Trigger Failure was overridden by another trigger and will not send an email.
      Sending email for trigger: Still Failing
      An attempt to send an e-mail to empty list of recipients, ignored.
      Finished: FAILURE}}

      More details in the attachment.

      This problem doesn't occur if I start the same maven command locally on that slave computer or if I start the test run on the Hudson master. So the problem must be somewhere in the slave agent starting the maven job.

      The Hudson Sonar plugin doesn't work here as it constantly fails to load its dependencies under Maven 2.2.1, but this is a bug from the maven-sonar-plugin - that is why we hardcoded the plugin version number in the call above

        Issue Links

          Activity

          Hide
          liyatikal liyatikal added a comment -

          We have the same problem n master as well - running sonar:sonar in the existing workspace directly on the machine works just fine.
          I tried Windows/Linux slave, Linux master - same result.

          I've noticed that it always fails after recording test results for the first module that has unit tests, right after these lines:
          Cobertura: Loaded information on XXX classes.
          Cobertura: Saved information on XXX classes.
          [HUDSON] Recording test results

          Show
          liyatikal liyatikal added a comment - We have the same problem n master as well - running sonar:sonar in the existing workspace directly on the machine works just fine. I tried Windows/Linux slave, Linux master - same result. I've noticed that it always fails after recording test results for the first module that has unit tests, right after these lines: Cobertura: Loaded information on XXX classes. Cobertura: Saved information on XXX classes. [HUDSON] Recording test results
          Hide
          shamim shamim bhuiyan added a comment -

          sonar:sonar with any other mvn goals will run fine, as example
          clean install sonar:sonar

          Show
          shamim shamim bhuiyan added a comment - sonar:sonar with any other mvn goals will run fine, as example clean install sonar:sonar
          Hide
          godin godin added a comment -

          Closed as outdated. Feel free to use Sonar Users Mailing List ( http://www.sonarsource.org/support/ ) if problem still persists.

          Show
          godin godin added a comment - Closed as outdated. Feel free to use Sonar Users Mailing List ( http://www.sonarsource.org/support/ ) if problem still persists.
          Hide
          euler david lv added a comment -

          I've run into the problem too, and fixed it by modified source of dom4j. the problem should be caused by classloading. You can find the solution here:

          http://www.beyondlinux.com/blog/?p=27

          Show
          euler david lv added a comment - I've run into the problem too, and fixed it by modified source of dom4j. the problem should be caused by classloading. You can find the solution here: http://www.beyondlinux.com/blog/?p=27

            People

            • Assignee:
              sonarteam Sonar Team
              Reporter:
              schlaufuchs schlaufuchs
            • Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: