java.lang.ClassCastException: com.cloudbees.hudson.plugins.folder.relocate.RelocateTask cannot be cast to hudson.model.Job

Jenkins JIRA | Jesse Glick | 3 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    A user of {{cloudbees-folders-plus}} (from Jenkins Enterprise) reports that moving a job from folder to Jenkins root is broken with {code:none} java.lang.ClassCastException: com.cloudbees.hudson.plugins.folder.relocate.RelocateTask cannot be cast to hudson.model.Job at jenkins.advancedqueue.PriorityConfiguration.getPriorityInternal(PriorityConfiguration.java:207) at jenkins.advancedqueue.PriorityConfiguration.getPriority(PriorityConfiguration.java:199) at jenkins.advancedqueue.sorter.AdvancedQueueSorter.onNewItem(AdvancedQueueSorter.java:111) at jenkins.advancedqueue.sorter.AdvancedQueueSorter.getCalculatedWeight(AdvancedQueueSorter.java:103) at jenkins.advancedqueue.sorter.AdvancedQueueSorter.access$000(AdvancedQueueSorter.java:47) at jenkins.advancedqueue.sorter.AdvancedQueueSorter$2.compare(AdvancedQueueSorter.java:78) at jenkins.advancedqueue.sorter.AdvancedQueueSorter$2.compare(AdvancedQueueSorter.java:76) at java.util.TimSort.countRunAndMakeAscending(Unknown Source) at java.util.TimSort.sort(Unknown Source) at java.util.TimSort.sort(Unknown Source) at java.util.Arrays.sort(Unknown Source) at java.util.Collections.sort(Unknown Source) at jenkins.advancedqueue.sorter.AdvancedQueueSorter.sortBuildableItems(AdvancedQueueSorter.java:76) at hudson.model.Queue.maintain(Queue.java:1092) at hudson.model.Queue$MaintainTask.doRun(Queue.java:2084) at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54) at java.util.TimerThread.mainLoop(Unknown Source) at java.util.TimerThread.run(Unknown Source) {code} Probably other special queue tasks would also be broken by this plugin, which assumes without checking that every {{Task}} is a {{Job}}.

    Jenkins JIRA | 3 years ago | Jesse Glick
    java.lang.ClassCastException: com.cloudbees.hudson.plugins.folder.relocate.RelocateTask cannot be cast to hudson.model.Job
  2. 0

    A user of {{cloudbees-folders-plus}} (from Jenkins Enterprise) reports that moving a job from folder to Jenkins root is broken with {code:none} java.lang.ClassCastException: com.cloudbees.hudson.plugins.folder.relocate.RelocateTask cannot be cast to hudson.model.Job at jenkins.advancedqueue.PriorityConfiguration.getPriorityInternal(PriorityConfiguration.java:207) at jenkins.advancedqueue.PriorityConfiguration.getPriority(PriorityConfiguration.java:199) at jenkins.advancedqueue.sorter.AdvancedQueueSorter.onNewItem(AdvancedQueueSorter.java:111) at jenkins.advancedqueue.sorter.AdvancedQueueSorter.getCalculatedWeight(AdvancedQueueSorter.java:103) at jenkins.advancedqueue.sorter.AdvancedQueueSorter.access$000(AdvancedQueueSorter.java:47) at jenkins.advancedqueue.sorter.AdvancedQueueSorter$2.compare(AdvancedQueueSorter.java:78) at jenkins.advancedqueue.sorter.AdvancedQueueSorter$2.compare(AdvancedQueueSorter.java:76) at java.util.TimSort.countRunAndMakeAscending(Unknown Source) at java.util.TimSort.sort(Unknown Source) at java.util.TimSort.sort(Unknown Source) at java.util.Arrays.sort(Unknown Source) at java.util.Collections.sort(Unknown Source) at jenkins.advancedqueue.sorter.AdvancedQueueSorter.sortBuildableItems(AdvancedQueueSorter.java:76) at hudson.model.Queue.maintain(Queue.java:1092) at hudson.model.Queue$MaintainTask.doRun(Queue.java:2084) at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54) at java.util.TimerThread.mainLoop(Unknown Source) at java.util.TimerThread.run(Unknown Source) {code} Probably other special queue tasks would also be broken by this plugin, which assumes without checking that every {{Task}} is a {{Job}}.

    Jenkins JIRA | 3 years ago | Jesse Glick
    java.lang.ClassCastException: com.cloudbees.hudson.plugins.folder.relocate.RelocateTask cannot be cast to hudson.model.Job

    Root Cause Analysis

    1. java.lang.ClassCastException

      com.cloudbees.hudson.plugins.folder.relocate.RelocateTask cannot be cast to hudson.model.Job

      at jenkins.advancedqueue.PriorityConfiguration.getPriorityInternal()
    2. jenkins.advancedqueue
      PriorityConfiguration.getPriority
      1. jenkins.advancedqueue.PriorityConfiguration.getPriorityInternal(PriorityConfiguration.java:207)
      2. jenkins.advancedqueue.PriorityConfiguration.getPriority(PriorityConfiguration.java:199)
      2 frames
    3. jenkins.advancedqueue.sorter
      AdvancedQueueSorter$2.compare
      1. jenkins.advancedqueue.sorter.AdvancedQueueSorter.onNewItem(AdvancedQueueSorter.java:111)
      2. jenkins.advancedqueue.sorter.AdvancedQueueSorter.getCalculatedWeight(AdvancedQueueSorter.java:103)
      3. jenkins.advancedqueue.sorter.AdvancedQueueSorter.access$000(AdvancedQueueSorter.java:47)
      4. jenkins.advancedqueue.sorter.AdvancedQueueSorter$2.compare(AdvancedQueueSorter.java:78)
      5. jenkins.advancedqueue.sorter.AdvancedQueueSorter$2.compare(AdvancedQueueSorter.java:76)
      5 frames
    4. Java RT
      Collections.sort
      1. java.util.TimSort.countRunAndMakeAscending(Unknown Source)
      2. java.util.TimSort.sort(Unknown Source)
      3. java.util.TimSort.sort(Unknown Source)
      4. java.util.Arrays.sort(Unknown Source)
      5. java.util.Collections.sort(Unknown Source)
      5 frames
    5. jenkins.advancedqueue.sorter
      AdvancedQueueSorter.sortBuildableItems
      1. jenkins.advancedqueue.sorter.AdvancedQueueSorter.sortBuildableItems(AdvancedQueueSorter.java:76)
      1 frame
    6. Hudson
      SafeTimerTask.run
      1. hudson.model.Queue.maintain(Queue.java:1092)
      2. hudson.model.Queue$MaintainTask.doRun(Queue.java:2084)
      3. hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
      3 frames
    7. Java RT
      TimerThread.run
      1. java.util.TimerThread.mainLoop(Unknown Source)
      2. java.util.TimerThread.run(Unknown Source)
      2 frames