java.lang.NullPointerException: null

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

    HQL Exception (org.hibernate.dialect.Dialect$3)

    Stack Overflow | 4 years ago | Hari
    java.lang.NullPointerException: null
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Error loading model properties in JPA on play 2.0.3

    Stack Overflow | 4 years ago | Chappies
    java.lang.NullPointerException: null

    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

      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