java.lang.Error: java.lang.reflect.InvocationTargetException

Google Groups | mwe...@java.net (JIRA) | 6 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

    *Update*: when this problem was first reported, it appeared that the Monitoring plugin was involved. It now turns out that the problem is there even if it isn't, and the problem can appear with just the Priority Sorter plugin and the Folders plugin. See the 3rd comment below. original report ---> This is Jenkins 2.19 with (amongst others): * Priority Sorter plugin 3.4 * Folders plugin 2.12 * Monitoring plugin 1.60.0 If I restart Jenkins and there are jobs in the queue from before the shutdown, exceptions are thrown on startup (see stack trace bellow). If the Monitoring plugin is also installed, Jenkins fails to start. The problem seems to be if when Jenkins starts there is already a job in the queue that is inside a folder, that the Priority Sorter plugin cannot handle it, and throws an exception. If the Monitoring plugin is installed, then this actually prevents Jenkins starting. {noformat} WARNING: QueueListener failed while processing hudson.model.Queue$BuildableItem:hudson.model.FreeStyleProject@52b26aad[dials_repositories/dials_svn_trigger_mixed]:200136 java.lang.ClassCastException: com.cloudbees.hudson.plugins.folder.properties.FolderCredentialsProvider$FolderCredentialsProperty cannot be cast to com.cloudbees.hudson.plugins.folder.FolderProperty at jenkins.advancedqueue.jobinclusion.strategy.FolderPropertyLoader.getJobGroupName(FolderPropertyLoader.java:50) at jenkins.advancedqueue.jobinclusion.strategy.PropertyBasedJobInclusionStrategy.contains(PropertyBasedJobInclusionStrategy.java:98) at jenkins.advancedqueue.PriorityConfiguration.getJobGroup(PriorityConfiguration.java:241) at jenkins.advancedqueue.PriorityConfiguration.getPriorityInternal(PriorityConfiguration.java:225) at jenkins.advancedqueue.PriorityConfiguration.getPriority(PriorityConfiguration.java:203) at jenkins.advancedqueue.sorter.AdvancedQueueSorter.onNewItem(AdvancedQueueSorter.java:136) at jenkins.advancedqueue.sorter.AdvancedQueueSorterQueueListener.onEnterBuildable(AdvancedQueueSorterQueueListener.java:60) at hudson.model.Queue$BuildableItem.enter(Queue.java:2522) at hudson.model.Queue.load(Queue.java:405) at hudson.model.Queue.init(Queue.java:2872) 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 hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104) at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282) at jenkins.model.Jenkins$7.runTask(Jenkins.java:1026) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) 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) {noformat} And another stack trace I see: {noformat} Aug 24, 2016 8:42:11 AM hudson.model.Queue$LeftItem enter WARNING: QueueListener failed while processing hudson.model.Queue$LeftItem:hudson.model.FreeStyleProject@52b26aad[dials_repositories/dials_svn_trigger_mixed]:200136 java.lang.NullPointerException at jenkins.advancedqueue.sorter.AdvancedQueueSorter.onLeft(AdvancedQueueSorter.java:145) at jenkins.advancedqueue.sorter.AdvancedQueueSorterQueueListener.onLeft(AdvancedQueueSorterQueueListener.java:51) at hudson.model.Queue$LeftItem.enter(Queue.java:2600) at hudson.model.Queue.onStartExecuting(Queue.java:1117) at hudson.model.Executor$1.call(Executor.java:354) at hudson.model.Executor$1.call(Executor.java:340) at hudson.model.Queue._withLock(Queue.java:1362) at hudson.model.Queue.withLock(Queue.java:1223) at hudson.model.Executor.run(Executor.java:340) Aug 24, 2016 8:42:11 AM hudson.model.listeners.RunListener report WARNING: RunListener failed java.lang.ClassCastException: com.cloudbees.hudson.plugins.folder.properties.FolderCredentialsProvider$FolderCredentialsProperty cannot be cast to com.cloudbees.hudson.plugins.folder.FolderProperty at jenkins.advancedqueue.jobinclusion.strategy.FolderPropertyLoader.getJobGroupName(FolderPropertyLoader.java:50) at jenkins.advancedqueue.jobinclusion.strategy.PropertyBasedJobInclusionStrategy.contains(PropertyBasedJobInclusionStrategy.java:98) at jenkins.advancedqueue.PriorityConfiguration.getJobGroup(PriorityConfiguration.java:241) at jenkins.advancedqueue.RunExclusiveThrottler$RunExclusiveRunListener.onStarted(RunExclusiveThrottler.java:49) at hudson.model.listeners.RunListener.fireStarted(RunListener.java:240) at hudson.model.Run.execute(Run.java:1716) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:404) {noformat} I installed the Monitoring plugin and restarted Jenkins. Jenkins failed during startup. Here's the stack trace: {noformat} Aug 24, 2016 8:33:44 AM jenkins.InitReactorRunner$1 onTaskFailed SEVERE: Failed PrioritySorterPlugin.init2 java.lang.Error: java.lang.reflect.InvocationTargetException at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110) at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282) at jenkins.model.Jenkins$7.runTask(Jenkins.java:1026) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) 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.reflect.InvocationTargetException 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 hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104) ... 8 more Caused by: java.lang.ClassCastException: com.cloudbees.hudson.plugins.folder.properties.FolderCredentialsProvider$FolderCredentialsProperty cannot be cast to com.cloudbees.hudson.plugins.folder.FolderProperty at jenkins.advancedqueue.jobinclusion.strategy.FolderPropertyLoader.getJobGroupName(FolderPropertyLoader.java:50) at jenkins.advancedqueue.jobinclusion.strategy.PropertyBasedJobInclusionStrategy.contains(PropertyBasedJobInclusionStrategy.java:98) at jenkins.advancedqueue.PriorityConfiguration.getJobGroup(PriorityConfiguration.java:241) at jenkins.advancedqueue.PriorityConfiguration.getPriorityInternal(PriorityConfiguration.java:225) at jenkins.advancedqueue.PriorityConfiguration.getPriority(PriorityConfiguration.java:203) at jenkins.advancedqueue.sorter.AdvancedQueueSorter.onNewItem(AdvancedQueueSorter.java:136) at jenkins.advancedqueue.sorter.AdvancedQueueSorter.init(AdvancedQueueSorter.java:66) at jenkins.advancedqueue.PrioritySorterPlugin.init2(PrioritySorterPlugin.java:69) ... 13 more Aug 24, 2016 8:33:44 AM jenkins.model.Jenkins$7 runTask INFO: Took 1ms for PeriodicWork.init by InitReactorRunner [#1] Aug 24, 2016 8:33:44 AM hudson.util.BootFailure publish SEVERE: Failed to initialize Jenkins hudson.util.HudsonFailedToLoad: org.jvnet.hudson.reactor.ReactorException: java.lang.Error: java.lang.reflect.InvocationTargetException at hudson.WebAppMain$3.run(WebAppMain.java:244) Caused by: org.jvnet.hudson.reactor.ReactorException: java.lang.Error: java.lang.reflect.InvocationTargetException at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:269) at jenkins.InitReactorRunner.run(InitReactorRunner.java:47) at jenkins.model.Jenkins.executeReactor(Jenkins.java:1050) at jenkins.model.Jenkins.<init>(Jenkins.java:905) at hudson.model.Hudson.<init>(Hudson.java:85) at hudson.model.Hudson.<init>(Hudson.java:81) at hudson.WebAppMain$3.run(WebAppMain.java:227) Caused by: java.lang.Error: java.lang.reflect.InvocationTargetException at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110) at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282) at jenkins.model.Jenkins$7.runTask(Jenkins.java:1026) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) 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.reflect.InvocationTargetException 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 hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104) ... 8 more Caused by: java.lang.ClassCastException: com.cloudbees.hudson.plugins.folder.properties.FolderCredentialsProvider$FolderCredentialsProperty cannot be cast to com.cloudbees.hudson.plugins.folder.FolderProperty at jenkins.advancedqueue.jobinclusion.strategy.FolderPropertyLoader.getJobGroupName(FolderPropertyLoader.java:50) at jenkins.advancedqueue.jobinclusion.strategy.PropertyBasedJobInclusionStrategy.contains(PropertyBasedJobInclusionStrategy.java:98) at jenkins.advancedqueue.PriorityConfiguration.getJobGroup(PriorityConfiguration.java:241) at jenkins.advancedqueue.PriorityConfiguration.getPriorityInternal(PriorityConfiguration.java:225) at jenkins.advancedqueue.PriorityConfiguration.getPriority(PriorityConfiguration.java:203) at jenkins.advancedqueue.sorter.AdvancedQueueSorter.onNewItem(AdvancedQueueSorter.java:136) at jenkins.advancedqueue.sorter.AdvancedQueueSorter.init(AdvancedQueueSorter.java:66) at jenkins.advancedqueue.PrioritySorterPlugin.init2(PrioritySorterPlugin.java:69) ... 13 more Aug 24, 2016 8:33:44 AM hudson.model.AsyncPeriodicWork$1 run INFO: Started Download metadata Aug 24, 2016 8:33:44 AM jenkins.model.Jenkins cleanUp INFO: Stopping Jenkins Aug 24, 2016 8:33:44 AM hudson.model.AsyncPeriodicWork$1 run INFO: Finished Download metadata. 2 ms Aug 24, 2016 8:33:44 AM jenkins.model.Jenkins$21 onAttained INFO: Started termination Aug 24, 2016 8:33:44 AM jenkins.model.Jenkins$21 onAttained INFO: Completed termination Aug 24, 2016 8:33:44 AM jenkins.model.Jenkins _cleanUpDisconnectComputers INFO: Starting node disconnection Aug 24, 2016 8:33:44 AM jenkins.model.Jenkins _cleanUpShutdownPluginManager INFO: Stopping plugin manager Aug 24, 2016 8:33:44 AM hudson.plugins.sshslaves.PluginImpl closeRegisteredConnections INFO: Forcing connection to cs03r-cs-serv-16.cs.diamond.ac.uk:22 closed. Aug 24, 2016 8:33:44 AM com.sonyericsson.hudson.plugins.gerrit.trigger.GerritServer stop INFO: Stopping GerritServer DASC Gerrit Aug 24, 2016 8:33:44 AM com.sonyericsson.hudson.plugins.gerrit.trigger.GerritProjectListUpdater tryLoadProjectList INFO: Trying to load project list. Aug 24, 2016 8:33:44 AM net.bull.javamelody.JavaLogger warn WARNING: exception while collecting data: java.lang.IllegalStateException: Timer already cancelled. java.lang.IllegalStateException: Timer already cancelled. at java.util.Timer.sched(Timer.java:397) at java.util.Timer.schedule(Timer.java:248) at net.bull.javamelody.RrdNioBackend.<init>(RrdNioBackend.java:66) at net.bull.javamelody.RrdNioBackendFactory.open(RrdNioBackendFactory.java:84) at org.jrobin.core.RrdDb.<init>(RrdDb.java:229) at org.jrobin.core.RrdDb.<init>(RrdDb.java:203) at org.jrobin.core.RrdDb.<init>(RrdDb.java:266) at org.jrobin.core.RrdDbPool.requestRrdDb(RrdDbPool.java:103) at net.bull.javamelody.JRobin.addValue(JRobin.java:338) at net.bull.javamelody.Collector.collectJRobinValues(Collector.java:526) at net.bull.javamelody.Collector.collectJavaInformations(Collector.java:381) at net.bull.javamelody.Collector.collect(Collector.java:319) at net.bull.javamelody.Collector.collectWithoutErrors(Collector.java:305) at net.bull.javamelody.NodesCollector.collectWithoutErrorsNow(NodesCollector.java:169) at net.bull.javamelody.NodesCollector.collectWithoutErrors(NodesCollector.java:143) at net.bull.javamelody.NodesCollector$2.run(NodesCollector.java:111) at java.util.TimerThread.mainLoop(Timer.java:555) at java.util.TimerThread.run(Timer.java:505) {noformat}

    Jenkins JIRA | 6 months ago | Matthew Webber
    java.lang.Error: java.lang.reflect.InvocationTargetException
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      com.cloudbees.hudson.plugins.folder.properties.FolderCredentialsProvider$FolderCredentialsProperty cannot be cast to com.cloudbees.hudson.plugins.folder.FolderProperty

      at jenkins.advancedqueue.jobinclusion.strategy.FolderPropertyLoader.getJobGroupName()
    2. jenkins.advancedqueue.jobinclusion
      PropertyBasedJobInclusionStrategy.contains
      1. jenkins.advancedqueue.jobinclusion.strategy.FolderPropertyLoader.getJobGroupName(FolderPropertyLoader.java:50)
      2. jenkins.advancedqueue.jobinclusion.strategy.PropertyBasedJobInclusionStrategy.contains(PropertyBasedJobInclusionStrategy.java:98)
      2 frames
    3. jenkins.advancedqueue
      PriorityConfiguration.getPriority
      1. jenkins.advancedqueue.PriorityConfiguration.getJobGroup(PriorityConfiguration.java:241)
      2. jenkins.advancedqueue.PriorityConfiguration.getPriorityInternal(PriorityConfiguration.java:225)
      3. jenkins.advancedqueue.PriorityConfiguration.getPriority(PriorityConfiguration.java:203)
      3 frames
    4. jenkins.advancedqueue.sorter
      AdvancedQueueSorter.init
      1. jenkins.advancedqueue.sorter.AdvancedQueueSorter.onNewItem(AdvancedQueueSorter.java:136)
      2. jenkins.advancedqueue.sorter.AdvancedQueueSorter.init(AdvancedQueueSorter.java:66)
      2 frames
    5. jenkins.advancedqueue
      PrioritySorterPlugin.init2
      1. jenkins.advancedqueue.PrioritySorterPlugin.init2(PrioritySorterPlugin.java:69)
      1 frame
    6. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:498)
      4 frames
    7. Hudson
      TaskMethodFinder$TaskImpl.run
      1. hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
      2. hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
      2 frames
    8. init
      Reactor.runTask
      1. org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
      1 frame
    9. jenkins.model
      Jenkins$7.runTask
      1. jenkins.model.Jenkins$7.runTask(Jenkins.java:1026)
      1 frame
    10. init
      Reactor$Node.run
      1. org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
      2. org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
      2 frames
    11. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      3. java.lang.Thread.run(Thread.java:745)
      3 frames