java.lang.NullPointerException

Jenkins JIRA | Matthew Webber | 4 months ago
  1. 0

    [JIRA] (JENKINS-37644) Priority Sorter + Folders plugin incompatible; can prevent Jenkins starting

    Google Groups | 4 months ago | mwe...@java.net (JIRA)
    java.lang.NullPointerException
  2. 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 | 4 months ago | Matthew Webber
    java.lang.NullPointerException
  3. 0

    NullPointerExceptions during startup. They are caught by calling class, so not major but still, we do not want to log warnings for normal things that can happen. There is a null check in AdvancedQueueSorterQueueListener.onEnterBuildable() but not in the other three event methods in the class. In AdvancedQueueSorter I see newer code that might have fixed this? Sep 29, 2014 10:13:58 AM hudson.model.Queue$BlockedItem enter WARNING: QueueListener failed while processing hudson.model.Queue$BlockedItem:hudson.model.FreeStyleProject@470c5677[alo_integration_build]:471 java.lang.NullPointerException at jenkins.advancedqueue.sorter.AdvancedQueueSorterQueueListener.onEnterBlocked(AdvancedQueueSorterQueueListener.java:61) at hudson.model.Queue$BlockedItem.enter(Queue.java:1712) at hudson.model.Queue.load(Queue.java:372) at hudson.model.Queue.init(Queue.java:2075) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:105) at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:169) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282) at jenkins.model.Jenkins$7.runTask(Jenkins.java:904) 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:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) Sep 29, 2014 11:05:45 AM hudson.model.Queue$LeftItem enter WARNING: QueueListener failed while processing hudson.model.Queue$LeftItem:hudson.model.FreeStyleProject@185eede4[Build-tivotool_Chips]:495 java.lang.NullPointerException at jenkins.advancedqueue.sorter.AdvancedQueueSorter.onLeft(AdvancedQueueSorter.java:131) at jenkins.advancedqueue.sorter.AdvancedQueueSorterQueueListener.onLeft(AdvancedQueueSorterQueueListener.java:47) at hudson.model.Queue$LeftItem.enter(Queue.java:1884) at hudson.model.Queue.onStartExecuting(Queue.java:914) at hudson.model.Executor.run(Executor.java:207)

    Jenkins JIRA | 2 years ago | Marcus Philip
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    NullPointerExceptions during startup. They are caught by calling class, so not major but still, we do not want to log warnings for normal things that can happen. There is a null check in AdvancedQueueSorterQueueListener.onEnterBuildable() but not in the other three event methods in the class. In AdvancedQueueSorter I see newer code that might have fixed this? Sep 29, 2014 10:13:58 AM hudson.model.Queue$BlockedItem enter WARNING: QueueListener failed while processing hudson.model.Queue$BlockedItem:hudson.model.FreeStyleProject@470c5677[alo_integration_build]:471 java.lang.NullPointerException at jenkins.advancedqueue.sorter.AdvancedQueueSorterQueueListener.onEnterBlocked(AdvancedQueueSorterQueueListener.java:61) at hudson.model.Queue$BlockedItem.enter(Queue.java:1712) at hudson.model.Queue.load(Queue.java:372) at hudson.model.Queue.init(Queue.java:2075) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:105) at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:169) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282) at jenkins.model.Jenkins$7.runTask(Jenkins.java:904) 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:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) Sep 29, 2014 11:05:45 AM hudson.model.Queue$LeftItem enter WARNING: QueueListener failed while processing hudson.model.Queue$LeftItem:hudson.model.FreeStyleProject@185eede4[Build-tivotool_Chips]:495 java.lang.NullPointerException at jenkins.advancedqueue.sorter.AdvancedQueueSorter.onLeft(AdvancedQueueSorter.java:131) at jenkins.advancedqueue.sorter.AdvancedQueueSorterQueueListener.onLeft(AdvancedQueueSorterQueueListener.java:47) at hudson.model.Queue$LeftItem.enter(Queue.java:1884) at hudson.model.Queue.onStartExecuting(Queue.java:914) at hudson.model.Executor.run(Executor.java:207)

    Jenkins JIRA | 2 years ago | Marcus Philip
    java.lang.NullPointerException
  6. 0

    [JIRA] (JENKINS-37644) Priority Sorter + Folders plugins incompatible; can prevent Jenkins starting

    Google Groups | 3 months ago | mwe...@java.net (JIRA)
    java.lang.NullPointerException

    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.NullPointerException

      No message provided

      at jenkins.advancedqueue.sorter.AdvancedQueueSorter.onLeft()
    2. jenkins.advancedqueue.sorter
      AdvancedQueueSorterQueueListener.onLeft
      1. jenkins.advancedqueue.sorter.AdvancedQueueSorter.onLeft(AdvancedQueueSorter.java:145)
      2. jenkins.advancedqueue.sorter.AdvancedQueueSorterQueueListener.onLeft(AdvancedQueueSorterQueueListener.java:51)
      2 frames
    3. Hudson
      Executor.run
      1. hudson.model.Queue$LeftItem.enter(Queue.java:2600)
      2. hudson.model.Queue.onStartExecuting(Queue.java:1117)
      3. hudson.model.Executor$1.call(Executor.java:354)
      4. hudson.model.Executor$1.call(Executor.java:340)
      5. hudson.model.Queue._withLock(Queue.java:1362)
      6. hudson.model.Queue.withLock(Queue.java:1223)
      7. hudson.model.Executor.run(Executor.java:340)
      7 frames