java.lang.NullPointerException: null

Spring JIRA | Costi Ciudatu | 4 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

    I spotted a NPE in my webmvc-based application log with the following stacktrace: {noformat} java.lang.NullPointerException: null at org.springframework.web.method.annotation.ModelFactory.findSessionAttributeArguments(ModelFactory.java:141) ~[spring-web-3.2.1.RELEASE.jar:3 .2.1.RELEASE] at org.springframework.web.method.annotation.ModelFactory.initModel(ModelFactory.java:99) ~[spring-web-3.2.1.RELEASE.jar:3.2.1.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:722) ~[spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686) ~[s pring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) ~[spring-webmvc-3.2.1.R ELEASE.jar:3.2.1.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925) ~[spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) ~[spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920) [spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:816) [spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:735) [servlet-api-3.0.jar:na] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801) [spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) [servlet-api-3.0.jar:na] ............ {noformat} After digging into the code, I realized that the shared {{org.springframework.web.method.HandlerMethod}} instance is performing lazy initialization of its internal {{MethodParameter}} array without any synchronization. I therefore assume that the above error was due to one thread reading the array before the other one finished filling it. There's actually no other possible way that array could contain a null value. This assumption is also backed by the fact that the error occured immediately after a server restart and I haven't been able to reproduce it.

    Spring JIRA | 4 years ago | Costi Ciudatu
    java.lang.NullPointerException: null
  2. 0

    I spotted a NPE in my webmvc-based application log with the following stacktrace: {noformat} java.lang.NullPointerException: null at org.springframework.web.method.annotation.ModelFactory.findSessionAttributeArguments(ModelFactory.java:141) ~[spring-web-3.2.1.RELEASE.jar:3 .2.1.RELEASE] at org.springframework.web.method.annotation.ModelFactory.initModel(ModelFactory.java:99) ~[spring-web-3.2.1.RELEASE.jar:3.2.1.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:722) ~[spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686) ~[s pring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) ~[spring-webmvc-3.2.1.R ELEASE.jar:3.2.1.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925) ~[spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) ~[spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920) [spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:816) [spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:735) [servlet-api-3.0.jar:na] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801) [spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) [servlet-api-3.0.jar:na] ............ {noformat} After digging into the code, I realized that the shared {{org.springframework.web.method.HandlerMethod}} instance is performing lazy initialization of its internal {{MethodParameter}} array without any synchronization. I therefore assume that the above error was due to one thread reading the array before the other one finished filling it. There's actually no other possible way that array could contain a null value. This assumption is also backed by the fact that the error occured immediately after a server restart and I haven't been able to reproduce it.

    Spring JIRA | 4 years ago | Costi Ciudatu
    java.lang.NullPointerException: null
  3. 0

    perl Regular Expression to find Java StackTrace by keyword

    Stack Overflow | 5 years ago | Gofrolist
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    openmeetings-user - [openmeetings-user] Install problems on centos 5.2 - msg#00087 - Recent Discussion OSDir.com

    osdir.com | 2 years ago
    java.lang.NullPointerException: null at org.openmeetings.app.hibernate.utils.HibernateUtil.createSession(HibernateUtil.java: 35) [openmeetings.jar:na] at org.openmeetings.app.data.basic.Configurationmanagement.getConfKey(Configurationmanagement.java: 50) [openmeetings.jar:na] at org.openmeetings.servlet.outputhandler.DefaultIndex.handleRequest(DefaultIndex.java: 38) [openmeetings.jar:na] at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doRequest(VelocityViewServlet.java: 541) [velocity-tools-view-1.3.jar:1.3] at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doGet(VelocityViewServlet.java: 507) [velocity-tools-view-1.3.jar:1.3]

    Root Cause Analysis

    1. java.lang.NullPointerException

      null

      at org.springframework.web.method.annotation.ModelFactory.findSessionAttributeArguments()
    2. Spring
      ModelFactory.initModel
      1. org.springframework.web.method.annotation.ModelFactory.findSessionAttributeArguments(ModelFactory.java:141)[spring-web-3.2.1.RELEASE.jar:3.2.1.RELEASE]
      2. org.springframework.web.method.annotation.ModelFactory.initModel(ModelFactory.java:99)[spring-web-3.2.1.RELEASE.jar:3.2.1.RELEASE]
      2 frames
    3. Spring MVC
      FrameworkServlet.doGet
      1. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:722)[spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE]
      2. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)[spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE]
      3. org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)[spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE]
      4. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)[spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE]
      5. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)[spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE]
      6. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920)[spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE]
      7. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:816)[spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE]
      7 frames
    4. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:735)[servlet-api-3.0.jar:na]
      1 frame
    5. Spring MVC
      FrameworkServlet.service
      1. org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801)[spring-webmvc-3.2.1.RELEASE.jar:3.2.1.RELEASE]
      1 frame
    6. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:848)[servlet-api-3.0.jar:na]
      1 frame