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

Jenkins JIRA | Jesse Glick | 3 years ago
  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
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Trying to enable the "trigger on docker hub updates" box in a multibranchproject yields: javax.servlet.ServletException: java.lang.ClassCastException: org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject cannot be cast to hudson.model.Job at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:796) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:233) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649) at org.kohsuke.stapler.Stapler.service(Stapler.java:238) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:126) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249) at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76) at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:499) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassCastException: org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject cannot be cast to hudson.model.Job at org.jenkinsci.plugins.registry.notification.DockerHubTrigger.start(DockerHubTrigger.java:69) at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.submit(ComputedFolder.java:233) at jenkins.branch.MultiBranchProject.submit(MultiBranchProject.java:518) at com.cloudbees.hudson.plugins.folder.AbstractFolder.doConfigSubmit(AbstractFolder.java:688) at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.doConfigSubmit(ComputedFolder.java:219) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:324) at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:52) at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:167) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:100) at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:124) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746) ... 58 more

    Jenkins JIRA | 8 months ago | Andrew Melo
    javax.servlet.ServletException: java.lang.ClassCastException: org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject cannot be cast to hudson.model.Job

    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

      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