java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be <span class="code-keyword" style="color: #000091">cast</span> to hudson.model.AbstractBuild

Google Groups | sebastia...@outlook.com (JIRA) | 7 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    [JIRA] (JENKINS-37136) Alternate build chooser is not working with the pipeline plugin

    Google Groups | 7 months ago | sebastia...@outlook.com (JIRA)
    java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be <span class="code-keyword" style="color: #000091">cast</span> to hudson.model.AbstractBuild
  2. 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 | 7 months ago | Sebastian Godelet
    java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild

    Root Cause Analysis

    1. java.lang.ClassCastException

      org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be <span class="code-keyword" style="color: #000091">cast</span> to hudson.model.AbstractBuild

      at org.jenkinsci.plugins.git.chooser.alternative.AlternativeBuildChooser$1.invoke()
    2. org.jenkinsci.plugins
      AlternativeBuildChooser$1.invoke
      1. org.jenkinsci.plugins.git.chooser.alternative.AlternativeBuildChooser$1.invoke(AlternativeBuildChooser.java:44)
      1 frame
    3. Hudson GIT plugin
      GitSCM$BuildChooserContextImpl.actOnBuild
      1. hudson.plugins.git.GitSCM$BuildChooserContextImpl.actOnBuild(GitSCM.java:907)
      1 frame
    4. org.jenkinsci.plugins
      AlternativeBuildChooser.getCandidateRevisions
      1. org.jenkinsci.plugins.git.chooser.alternative.AlternativeBuildChooser.getCandidateRevisions(AlternativeBuildChooser.java:44)
      1 frame
    5. Hudson GIT plugin
      GitSCM.checkout
      1. hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:995)
      2. hudson.plugins.git.GitSCM.checkout(GitSCM.java:1098)
      2 frames
    6. org.jenkinsci.plugins
      AbstractSynchronousNonBlockingStepExecution$1$1.call
      1. org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
      2. org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
      3. org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
      4. org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:49)
      4 frames
    7. Hudson
      ACL.impersonate
      1. hudson.security.ACL.impersonate(ACL.java:213)
      1 frame
    8. org.jenkinsci.plugins
      AbstractSynchronousNonBlockingStepExecution$1.run
      1. org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:47)
      1 frame
    9. Java RT
      ThreadPoolExecutor$Worker.run
      1. java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      2. java.util.concurrent.FutureTask.run(Unknown Source)
      3. java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      4. java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      4 frames