java.lang.NullPointerException

Jenkins JIRA | Michal Turek | 3 years 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

    Probable scenario is to refresh the job page (the one that displays the trend graph) while a build of that job is in progress. Jenkins output in the terminal console contains the stack traces like the one below. See the attached file for whole available output. {noformat} 2014-04-19 16:29:31.535::WARN: /job/Graphal/diskUsage/graph/map java.lang.NullPointerException at hudson.plugins.disk_usage.ProjectDiskUsageAction.getGraph(ProjectDiskUsageAction.java:227) 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:601) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:288) at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:203) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:574) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:659) at org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:384) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:574) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:659) at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:241) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:574) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:659) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:488) at org.kohsuke.stapler.Stapler.service(Stapler.java:162) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1074) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:95) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:47) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76) at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:146) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) at org.mortbay.jetty.Server.handle(Server.java:285) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:751) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:500) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475) Apr 19, 2014 4:29:44 PM hudson.model.Run run INFO: Graphal #9 main build action completed: SUCCESS {noformat} Variable dua is checked for null and then dua.getAllDiskUsage() is called outside of the condition. {noformat} for (int i=builds.size()-1; i>=0; i--) { AbstractBuild build = builds.get(i); BuildDiskUsageAction dua = build.getAction(BuildDiskUsageAction.class); if (dua != null) { usages.add(new Object[]{build, getJobRootDirDiskUsage(), dua.getAllDiskUsage(), getAllSlaveWorkspaces(), getAllCustomOrNonSlaveWorkspaces()}); } maxValue = Math.max(maxValue, dua.getAllDiskUsage()); } {noformat}

    Jenkins JIRA | 3 years ago | Michal Turek
    java.lang.NullPointerException
  2. 0

    Probable scenario is to refresh the job page (the one that displays the trend graph) while a build of that job is in progress. Jenkins output in the terminal console contains the stack traces like the one below. See the attached file for whole available output. {noformat} 2014-04-19 16:29:31.535::WARN: /job/Graphal/diskUsage/graph/map java.lang.NullPointerException at hudson.plugins.disk_usage.ProjectDiskUsageAction.getGraph(ProjectDiskUsageAction.java:227) 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:601) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:288) at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:203) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:574) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:659) at org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:384) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:574) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:659) at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:241) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:574) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:659) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:488) at org.kohsuke.stapler.Stapler.service(Stapler.java:162) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1074) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:95) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:47) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76) at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:146) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) at org.mortbay.jetty.Server.handle(Server.java:285) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:751) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:500) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475) Apr 19, 2014 4:29:44 PM hudson.model.Run run INFO: Graphal #9 main build action completed: SUCCESS {noformat} Variable dua is checked for null and then dua.getAllDiskUsage() is called outside of the condition. {noformat} for (int i=builds.size()-1; i>=0; i--) { AbstractBuild build = builds.get(i); BuildDiskUsageAction dua = build.getAction(BuildDiskUsageAction.class); if (dua != null) { usages.add(new Object[]{build, getJobRootDirDiskUsage(), dua.getAllDiskUsage(), getAllSlaveWorkspaces(), getAllCustomOrNonSlaveWorkspaces()}); } maxValue = Math.max(maxValue, dua.getAllDiskUsage()); } {noformat}

    Jenkins JIRA | 3 years ago | Michal Turek
    java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at hudson.plugins.disk_usage.ProjectDiskUsageAction.getGraph()
    2. hudson.plugins.disk_usage
      ProjectDiskUsageAction.getGraph
      1. hudson.plugins.disk_usage.ProjectDiskUsageAction.getGraph(ProjectDiskUsageAction.java:227)
      1 frame
    3. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:601)
      4 frames
    4. Stapler
      Stapler.service
      1. org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:288)
      2. org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:203)
      3. org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
      4. org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:574)
      5. org.kohsuke.stapler.Stapler.invoke(Stapler.java:659)
      6. org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:384)
      7. org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:574)
      8. org.kohsuke.stapler.Stapler.invoke(Stapler.java:659)
      9. org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:241)
      10. org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
      11. org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:574)
      12. org.kohsuke.stapler.Stapler.invoke(Stapler.java:659)
      13. org.kohsuke.stapler.Stapler.invoke(Stapler.java:488)
      14. org.kohsuke.stapler.Stapler.service(Stapler.java:162)
      14 frames
    5. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      1 frame
    6. Jetty Server
      ServletHandler$CachedChain.doFilter
      1. org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)
      2. org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1074)
      2 frames
    7. Hudson
      PluginServletFilter.doFilter
      1. hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:95)
      2. hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87)
      2 frames
    8. Jetty Server
      ServletHandler$CachedChain.doFilter
      1. org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
      1 frame
    9. Hudson
      CrumbFilter.doFilter
      1. hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:47)
      1 frame
    10. Jetty Server
      ServletHandler$CachedChain.doFilter
      1. org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
      1 frame
    11. Hudson
      HudsonFilter.doFilter
      1. hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      2. hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
      3. hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
      3 frames
    12. Jetty Server
      ServletHandler$CachedChain.doFilter
      1. org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
      1 frame
    13. Hudson
      CharacterEncodingFilter.doFilter
      1. hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
      1 frame
    14. Jetty Server
      SelectChannelEndPoint.run
      1. org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
      2. org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
      3. org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185)
      4. org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
      5. org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)
      6. org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)
      7. org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:146)
      8. org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
      9. org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
      10. org.mortbay.jetty.Server.handle(Server.java:285)
      11. org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)
      12. org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:751)
      13. org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:500)
      14. org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
      15. org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
      16. org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329)
      16 frames
    15. Jetty Util
      BoundedThreadPool$PoolThread.run
      1. org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
      1 frame