title: Spring boot application error from dispatcherServlet under load testing
body: <p>Declaration:
  This question is not as simple as a NullPointerException or how to deal with an NPE.  It is about multi-threading programming. I do know how to catch an exception, the problem is I can not locate the source of this exception and even cannot figure out the problem is performance bottleneck or bug in logic. So I come here to ask for your help. And finally, I found the bug and solved it in my own answer.</p>
  
  <p>I developed a REST API for uploading a chunk in the Spring boot application and passed the functionality testing. Below is the version info.</p>
  
  <pre><code>Spring Boot 1.5.8 with Embedded Tomcat
  </code></pre>
  
  <p>Now I wanna evaluate the performance under load testing with JMeter. And I designed the test plan and validated it in a gentle load successfully. Here is my test plan about Thread Properties,</p>
  
  <pre><code>Number of Threads (users): 3
  Ramp-Up Period (in seconds): 1
  Loop Count: 3
  </code></pre>
  
  <p>But when the load increased to 10 threads or even more, the test report showed some errors with 500 type. And the server printed some errors</p>
  
  <pre><code>    2018-01-20 20:34:23.744 ERROR 57809 --- [o-8083-exec-346] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] i
  n context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
  
  java.lang.NullPointerException: null
  </code></pre>
  
  <p>Does it mean that the server has reached the bottleneck or something else goes wrong in logical? And How can I debug and trace this problem?</p>
  
  <p>Thanks.</p>