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

Jenkins JIRA | Jan-Olav Eide | 2 years ago
  1. 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
  2. 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
  3. 0

    Workflow plugin class cast exception

    Google Groups | 2 years ago | Jan-Olav Eide
    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

    {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
  6. 0

    Executing the following: {code:title=Jenkinsfile} checkout([$class: 'GitSCM', branches: [[name: "origin/test"], [name: "origin/master"]], doGenerateSubmoduleConfigurations: false, submoduleCfg: [], userRemoteConfigs: [[url: 'some url', credentialsId: 'some creds']], extensions: [ [$class: 'PruneStaleBranch'], [$class: 'CleanBeforeCheckout'], [$class: 'BuildChooserSetting', buildChooser: [$class: 'AlternativeBuildChooser']] ] ]) {code} Throwing the following exception: {code} java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild at org.jenkinsci.plugins.git.chooser.alternative.AlternativeBuildChooser$1.invoke(AlternativeBuildChooser.java:44) at hudson.plugins.git.GitSCM$BuildChooserContextImpl.actOnBuild(GitSCM.java:907) at org.jenkinsci.plugins.git.chooser.alternative.AlternativeBuildChooser.getCandidateRevisions(AlternativeBuildChooser.java:44) at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:995) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1098) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:49) at hudson.security.ACL.impersonate(ACL.java:213) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) {code}

    Jenkins JIRA | 4 months ago | Sebastian Godelet
    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.zentimestamp.ZenTimestampEnvironmentContributor.buildEnvironmentFor()
    2. hudson.plugins.zentimestamp
      ZenTimestampEnvironmentContributor.buildEnvironmentFor
      1. hudson.plugins.zentimestamp.ZenTimestampEnvironmentContributor.buildEnvironmentFor(ZenTimestampEnvironmentContributor.java:23)
      1 frame
    3. Hudson
      SubversionSCM.checkout
      1. hudson.model.Run.getEnvironment(Run.java:2224)
      2. hudson.scm.SubversionSCM.checkout(SubversionSCM.java:827)
      2 frames
    4. org.jenkinsci.plugins
      CpsScript.invokeMethod
      1. org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:106)
      2. org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
      3. org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:70)
      4. org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:34)
      5. org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:136)
      6. org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:98)
      6 frames
    5. Groovy
      AbstractCallSite.call
      1. org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
      2. org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
      3. org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
      3 frames
    6. com.cloudbees.groovy
      DefaultInvoker.methodCall
      1. com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
      1 frame
    7. Unknown
      WorkflowScript.run
      1. WorkflowScript.run(WorkflowScript:2)
      1 frame