1

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.

I developed a REST API for uploading a chunk in the Spring boot application and passed the functionality testing. Below is the version info.

Spring Boot 1.5.8 with Embedded Tomcat

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,

Number of Threads (users): 3
Ramp-Up Period (in seconds): 1
Loop Count: 3

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

    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

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?

Thanks.

LeoZhang
  • 155
  • 1
  • 9
  • 10 threads is nothing. You have a bug somewhere. Look at the stack trace of the NullPointerException, and see where the bug is located. – JB Nizet Jan 21 '18 at 08:27
  • Paste a full stacktrace so we can get at least an idea what caused NPE – Szymon Stepniak Jan 21 '18 at 10:24
  • Possible duplicate of [What is a NullPointerException, and how do I fix it?](https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it) – user7294900 Jan 22 '18 at 10:24

1 Answers1

0

I got it. I found the full exception stack trace in the server's log file. The console missed the full stack information. And it threw the full information at the beginning and then just printed one sentence like I posted in my question which leads me to a hard way to debug this problem. Thanks anyway @JB Nizet, and you are right that I had a bug there.

LeoZhang
  • 155
  • 1
  • 9