java.lang.NullPointerException

Jenkins JIRA | ilkomiliev | 8 years ago
  1. 0

    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.

    Jenkins JIRA | 8 years ago | ilkomiliev
    java.lang.NullPointerException
  2. 0

    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.

    Jenkins JIRA | 8 years ago | ilkomiliev
    java.lang.NullPointerException
  3. 0

    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.

    Jenkins JIRA | 9 years ago | zeisss
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    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.

    Jenkins JIRA | 9 years ago | zeisss
    java.lang.NullPointerException
  6. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: 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 hudson.model.Hudson.setSecurityRealm()
    2. Hudson
      WebAppMain$2.run
      1. hudson.model.Hudson.setSecurityRealm(Hudson.java:1333)
      2. hudson.model.Hudson.load(Hudson.java:1696)
      3. hudson.model.Hudson.<init>(Hudson.java:446)
      4. hudson.WebAppMain$2.run(WebAppMain.java:160)
      4 frames