How to read and understand the java stack trace? [duplicate]

You should generally read from the top – so in this case, there’s a NullPointerException at line 66 of UnixServerJobController, in the handleRequest method. That method was called by SimpleControllerHandlerAdapter.handle, which was called by DispatcherServlet.doDispatch etc.

However, in this particular case it’s likely that the first frame of the stack trace is all you need. Look at line 66 of UnixServerJobController, work out what might be null, and act accordingly.

Note that sometimes one exception is wrapped in another (which may in turn be wrapped in another, etc). In this case you should look at each of the stack traces – often it’s the “most nested” exception which gives the most useful information, as that’s the root cause.

Leave a Comment