java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • v1.271 changes the security filter implementation in hudson. Unfortunately this causes NPE to be thrown at application start in WebSphere with the following stack trace: Failed to initialize Hudson java.lang.NullPointerException at hudson.model.Hudson.setSecurityRealm(Hudson.java:1333) at hudson.model.Hudson.load(Hudson.java:1696) at hudson.model.Hudson.<init>(Hudson.java:446) at hudson.WebAppMain$2.run(WebAppMain.java:160) The NPE is caused because the instance of HudsonFilter is not available at the initializing time of Hudson instance in the servlet context. This is probably caused by the fact that WebSphere loads and initializes Filters at the first call to the filter mapped resources and not at the start-up of the application. The related code segments are: WebAppMain tries to init Hudson in separate thread: new Thread("hudson initialization thread") { public void run() { try { try { context.setAttribute(APP,new Hudson(home,context)); } catch( IOException e ) { throw new Error(e); } initing new Hudson calls load(), which in turn tries to set the security realm to the proxy filter (in hudson.model.Hudson): public void setSecurityRealm(SecurityRealm securityRealm) { if(securityRealm==null) securityRealm= SecurityRealm.NO_AUTHENTICATION; this.securityRealm = securityRealm; // reset the filters and proxies for the new SecurityRealm try { HudsonFilter.get(servletContext).reset(securityRealm); } catch (ServletException e) { // for binary compatibility, this method cannot throw a checked exception throw new AcegiSecurityException("Failed to configure filter",e) {}; } } HudsonFilter.get(context) tries to find its own instance saved at the init time in its init(FilterConfig) method into the servlet context and fails because the filter hasn't been initialized yet (in hudson.security.HudsonFilter): public void init(FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig; // this is how we make us available to the rest of Hudson. filterConfig.getServletContext().setAttribute(HudsonFilter.class.getName(),this); } /** * Gets the {@link HudsonFilter} created for the given {@link ServletContext}. */ public static HudsonFilter get(ServletContext context) { return (HudsonFilter)context.getAttribute(HudsonFilter.class.getName()); } IMHO the implementation here relays upon the availability of the servlet filters at application start-up time, but this is container specific implementation, because the servlet specification does not define exactly at what time the container should load and initialize a filter, but only that this must be done prior to first call to mapped resource for this filter. Because of this I can't consider this as a WebSphere incompatibility.
    via by ilkomiliev,
  • v1.271 changes the security filter implementation in hudson. Unfortunately this causes NPE to be thrown at application start in WebSphere with the following stack trace: Failed to initialize Hudson java.lang.NullPointerException at hudson.model.Hudson.setSecurityRealm(Hudson.java:1333) at hudson.model.Hudson.load(Hudson.java:1696) at hudson.model.Hudson.<init>(Hudson.java:446) at hudson.WebAppMain$2.run(WebAppMain.java:160) The NPE is caused because the instance of HudsonFilter is not available at the initializing time of Hudson instance in the servlet context. This is probably caused by the fact that WebSphere loads and initializes Filters at the first call to the filter mapped resources and not at the start-up of the application. The related code segments are: WebAppMain tries to init Hudson in separate thread: new Thread("hudson initialization thread") { public void run() { try { try { context.setAttribute(APP,new Hudson(home,context)); } catch( IOException e ) { throw new Error(e); } initing new Hudson calls load(), which in turn tries to set the security realm to the proxy filter (in hudson.model.Hudson): public void setSecurityRealm(SecurityRealm securityRealm) { if(securityRealm==null) securityRealm= SecurityRealm.NO_AUTHENTICATION; this.securityRealm = securityRealm; // reset the filters and proxies for the new SecurityRealm try { HudsonFilter.get(servletContext).reset(securityRealm); } catch (ServletException e) { // for binary compatibility, this method cannot throw a checked exception throw new AcegiSecurityException("Failed to configure filter",e) {}; } } HudsonFilter.get(context) tries to find its own instance saved at the init time in its init(FilterConfig) method into the servlet context and fails because the filter hasn't been initialized yet (in hudson.security.HudsonFilter): public void init(FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig; // this is how we make us available to the rest of Hudson. filterConfig.getServletContext().setAttribute(HudsonFilter.class.getName(),this); } /** * Gets the {@link HudsonFilter} created for the given {@link ServletContext}. */ public static HudsonFilter get(ServletContext context) { return (HudsonFilter)context.getAttribute(HudsonFilter.class.getName()); } IMHO the implementation here relays upon the availability of the servlet filters at application start-up time, but this is container specific implementation, because the servlet specification does not define exactly at what time the container should load and initialize a filter, but only that this must be done prior to first call to mapped resource for this filter. Because of this I can't consider this as a WebSphere incompatibility.
    via by ilkomiliev,
  • After I upgraded a plugin to a new version, hudson fails to load up after beeing restarted. The error log contains the following infos: ==> /var/log/hudson/err.log <== Apr 16, 2008 12:00:14 PM hudson.TcpSlaveAgentListener <init> INFO: JNLP slave agent listener started on TCP port 33428 Apr 16, 2008 12:00:14 PM hudson.WebAppMain$2 run SEVERE: Failed to initialize Hudson java.lang.NullPointerException at hudson.model.Project.updateTransientActions(Project.java:162) at hudson.model.AbstractProject.onLoad(AbstractProject.java:166) at hudson.model.Project.onLoad(Project.java:61) at hudson.model.Items.load(Items.java:80) at hudson.model.Hudson.load(Hudson.java:1268) at hudson.model.Hudson.<init>(Hudson.java:346) at hudson.WebAppMain$2.run(WebAppMain.java:155) Exception in thread "hudson initialization thread" java.lang.NullPointerException at hudson.model.Project.updateTransientActions(Project.java:162) at hudson.model.AbstractProject.onLoad(AbstractProject.java:166) at hudson.model.Project.onLoad(Project.java:61) at hudson.model.Items.load(Items.java:80) at hudson.model.Hudson.load(Hudson.java:1268) at hudson.model.Hudson.<init>(Hudson.java:346) at hudson.WebAppMain$2.run(WebAppMain.java:155) When opening the webui it shows the "hudson loading ..." text and refreshs it every few seconds. There is no info that an error occured and you should take a look at the server. Furthermore it would be nice to have a button for restarting the loading procedure in such a state so I don't have to restart the whole server. Wished actions: 1. If any exception occures while loading: show it on the index page or give a hint that an exception occured. 2. Add a button with the same effect as the 'reload config from disc' in the manage hudson page.
    via by zeisss,
  • After I upgraded a plugin to a new version, hudson fails to load up after beeing restarted. The error log contains the following infos: ==> /var/log/hudson/err.log <== Apr 16, 2008 12:00:14 PM hudson.TcpSlaveAgentListener <init> INFO: JNLP slave agent listener started on TCP port 33428 Apr 16, 2008 12:00:14 PM hudson.WebAppMain$2 run SEVERE: Failed to initialize Hudson java.lang.NullPointerException at hudson.model.Project.updateTransientActions(Project.java:162) at hudson.model.AbstractProject.onLoad(AbstractProject.java:166) at hudson.model.Project.onLoad(Project.java:61) at hudson.model.Items.load(Items.java:80) at hudson.model.Hudson.load(Hudson.java:1268) at hudson.model.Hudson.<init>(Hudson.java:346) at hudson.WebAppMain$2.run(WebAppMain.java:155) Exception in thread "hudson initialization thread" java.lang.NullPointerException at hudson.model.Project.updateTransientActions(Project.java:162) at hudson.model.AbstractProject.onLoad(AbstractProject.java:166) at hudson.model.Project.onLoad(Project.java:61) at hudson.model.Items.load(Items.java:80) at hudson.model.Hudson.load(Hudson.java:1268) at hudson.model.Hudson.<init>(Hudson.java:346) at hudson.WebAppMain$2.run(WebAppMain.java:155) When opening the webui it shows the "hudson loading ..." text and refreshs it every few seconds. There is no info that an error occured and you should take a look at the server. Furthermore it would be nice to have a button for restarting the loading procedure in such a state so I don't have to restart the whole server. Wished actions: 1. If any exception occures while loading: show it on the index page or give a hint that an exception occured. 2. Add a button with the same effect as the 'reload config from disc' in the manage hudson page.
    via by zeisss,
    • java.lang.NullPointerException at hudson.model.Hudson.setSecurityRealm(Hudson.java:1333) at hudson.model.Hudson.load(Hudson.java:1696) at hudson.model.Hudson.<init>(Hudson.java:446) at hudson.WebAppMain$2.run(WebAppMain.java:160)
    No Bugmate found.