java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild

Jenkins JIRA | Todd Perry | 7 months ago
  1. 0

    After noting in JENKINS-27302 that version 4.6.0 of the clover plugin supports pipeline builds, I tried setting it up on a test job using a custom step as documented: {noformat} step([$class: 'CloverPublisher', cloverReportDir: 'build/tests/coverage', cloverReportFileName: 'clover.xml']) {noformat} This appears to work and puts a clover test result section in the results for an individual build, but after 2 builds it still doesn't display a coverage graph in the main Status page for the job. I tried restarting Jenkins, and got the following stack trace: {noformat} WARNING: failed to load hudson.plugins.clover.CloverBuildAction@33885e1d from /var/lib/jenkins/jobs/plonk/builds/13/build.xml java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild at hudson.plugins.clover.CloverBuildAction.onLoad(CloverBuildAction.java:156) at hudson.model.Run.onLoad(Run.java:346) at org.jenkinsci.plugins.workflow.job.WorkflowRun.onLoad(WorkflowRun.java:462) at hudson.model.RunMap.retrieve(RunMap.java:224) at hudson.model.RunMap.retrieve(RunMap.java:56) at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:479) at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:461) at jenkins.model.lazy.AbstractLazyLoadRunMap.getByNumber(AbstractLazyLoadRunMap.java:367) at jenkins.model.lazy.AbstractLazyLoadRunMap.search(AbstractLazyLoadRunMap.java:332) at jenkins.model.lazy.LazyBuildMixIn$RunMixIn.getPreviousBuild(LazyBuildMixIn.java:355) at org.jenkinsci.plugins.workflow.job.WorkflowRun.getPreviousBuild(WorkflowRun.java:178) at org.jenkinsci.plugins.workflow.job.WorkflowRun.getPreviousBuild(WorkflowRun.java:109) at hudson.model.Job.getBuildStabilityHealthReport(Job.java:1169) at hudson.model.Job.getBuildHealthReports(Job.java:1129) {noformat} After this, clover stats don't display anywhere in the build, including the individual build status page. The only way I could fix the startup error is to delete all the build histories that had clover info in them. I'm not sure if the stack trace and failure to display the graph are actually the same problem.

    Jenkins JIRA | 7 months ago | Todd Perry
    java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild
  2. 0

    After noting in JENKINS-27302 that version 4.6.0 of the clover plugin supports pipeline builds, I tried setting it up on a test job using a custom step as documented: {noformat} step([$class: 'CloverPublisher', cloverReportDir: 'build/tests/coverage', cloverReportFileName: 'clover.xml']) {noformat} This appears to work and puts a clover test result section in the results for an individual build, but after 2 builds it still doesn't display a coverage graph in the main Status page for the job. I tried restarting Jenkins, and got the following stack trace: {noformat} WARNING: failed to load hudson.plugins.clover.CloverBuildAction@33885e1d from /var/lib/jenkins/jobs/plonk/builds/13/build.xml java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild at hudson.plugins.clover.CloverBuildAction.onLoad(CloverBuildAction.java:156) at hudson.model.Run.onLoad(Run.java:346) at org.jenkinsci.plugins.workflow.job.WorkflowRun.onLoad(WorkflowRun.java:462) at hudson.model.RunMap.retrieve(RunMap.java:224) at hudson.model.RunMap.retrieve(RunMap.java:56) at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:479) at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:461) at jenkins.model.lazy.AbstractLazyLoadRunMap.getByNumber(AbstractLazyLoadRunMap.java:367) at jenkins.model.lazy.AbstractLazyLoadRunMap.search(AbstractLazyLoadRunMap.java:332) at jenkins.model.lazy.LazyBuildMixIn$RunMixIn.getPreviousBuild(LazyBuildMixIn.java:355) at org.jenkinsci.plugins.workflow.job.WorkflowRun.getPreviousBuild(WorkflowRun.java:178) at org.jenkinsci.plugins.workflow.job.WorkflowRun.getPreviousBuild(WorkflowRun.java:109) at hudson.model.Job.getBuildStabilityHealthReport(Job.java:1169) at hudson.model.Job.getBuildHealthReports(Job.java:1129) {noformat} After this, clover stats don't display anywhere in the build, including the individual build status page. The only way I could fix the startup error is to delete all the build histories that had clover info in them. I'm not sure if the stack trace and failure to display the graph are actually the same problem.

    Jenkins JIRA | 7 months ago | Todd Perry
    java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild
  3. 0

    [JIRA] [clover-plugin] (JENKINS-34439) Clover plugin still has problems with pipeline builds

    Google Groups | 7 months ago | per...@vtls.com (JIRA)
    java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Using the new workflow plugin, the ZenTimestamper fails with a class cast exception, since it seems to assume that this cast never fails https://github.com/jenkinsci/zentimestamp-plugin/blob/master/src/main/java/hudson/plugins/zentimestamp/ZenTimestampEnvironmentContributor.java#L23 Running: Allocate node : Start Running on master in C:\Jenkins\workspace\Demo workflow Running: Allocate node : Body : Start Running: Subversion Running: Allocate node : Body : End Running: Allocate node : End Running: End of Workflow java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild at hudson.plugins.zentimestamp.ZenTimestampEnvironmentContributor.buildEnvironmentFor(ZenTimestampEnvironmentContributor.java:23) at hudson.model.Run.getEnvironment(Run.java:2224) at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:827) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:106) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:70) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:34) at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:136) at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:98) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15) at WorkflowScript.run(WorkflowScript:2)

    Jenkins JIRA | 2 years ago | Jan-Olav Eide
    java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild
  6. 0

    {noformat} Jun 07, 2016 7:15:06 AM hudson.model.listeners.RunListener report WARNING: RunListener failed java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild at org.jenkinsci.plugins.junitrealtimetestreporter.Attacher.onStarted(Attacher.java:44) at hudson.model.listeners.RunListener.fireStarted(RunListener.java:213) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:198) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:381) Jun 07, 2016 7:15:23 AM org.jenkinsci.plugins.workflow.job.WorkflowRun finish INFO: Playground/pipeline test #2 completed: SUCCESS Jun 07, 2016 7:15:23 AM hudson.model.listeners.RunListener report WARNING: RunListener failed java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild at org.jenkinsci.plugins.junitrealtimetestreporter.Attacher.onFinalized(Attacher.java:54) at hudson.model.listeners.RunListener.fireFinalized(RunListener.java:230) at hudson.model.Run.onEndBuilding(Run.java:1890) at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:544) at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1100(WorkflowRun.java:111) at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:781) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:843) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$4.run(CpsThreadGroup.java:340) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:32) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) {noformat}

    Jenkins JIRA | 6 months ago | Oliver Gond┼ża
    java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild

      at hudson.plugins.clover.CloverBuildAction.onLoad()
    2. hudson.plugins.clover
      CloverBuildAction.onLoad
      1. hudson.plugins.clover.CloverBuildAction.onLoad(CloverBuildAction.java:156)
      1 frame
    3. Hudson
      Run.onLoad
      1. hudson.model.Run.onLoad(Run.java:346)
      1 frame
    4. org.jenkinsci.plugins
      WorkflowRun.onLoad
      1. org.jenkinsci.plugins.workflow.job.WorkflowRun.onLoad(WorkflowRun.java:462)
      1 frame
    5. Hudson
      RunMap.retrieve
      1. hudson.model.RunMap.retrieve(RunMap.java:224)
      2. hudson.model.RunMap.retrieve(RunMap.java:56)
      2 frames
    6. jenkins.model.lazy
      LazyBuildMixIn$RunMixIn.getPreviousBuild
      1. jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:479)
      2. jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:461)
      3. jenkins.model.lazy.AbstractLazyLoadRunMap.getByNumber(AbstractLazyLoadRunMap.java:367)
      4. jenkins.model.lazy.AbstractLazyLoadRunMap.search(AbstractLazyLoadRunMap.java:332)
      5. jenkins.model.lazy.LazyBuildMixIn$RunMixIn.getPreviousBuild(LazyBuildMixIn.java:355)
      5 frames
    7. org.jenkinsci.plugins
      WorkflowRun.getPreviousBuild
      1. org.jenkinsci.plugins.workflow.job.WorkflowRun.getPreviousBuild(WorkflowRun.java:178)
      2. org.jenkinsci.plugins.workflow.job.WorkflowRun.getPreviousBuild(WorkflowRun.java:109)
      2 frames
    8. Hudson
      Job.getBuildHealthReports
      1. hudson.model.Job.getBuildStabilityHealthReport(Job.java:1169)
      2. hudson.model.Job.getBuildHealthReports(Job.java:1129)
      2 frames