java.lang.ClassCastException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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.
    via by Todd Perry,
  • 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.
    via by Todd Perry,
    • 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)
    No Bugmate found.