Today, I found a problem. I wrote a code to send a request to the servlet, receive the response message, and then "the server returns 500" error. However, no exception record is found in the background log. then, send a request in the browser and find an exception record in the log.
I thought about it. I don't know what's going on. I have encountered several such problems before, but they all went around. I looked back at the code and found it was a problem with IDE.
The previous servlet service method does not declare and throw an exception during the Declaration. However, if you use the eclipse shortcut key to override the service method, the service method will be declared by default to throw servletexception and ioexception. therefore, if the code may throw these two exceptions, it will be thrown directly from the service method. Therefore, in this case, the IDE will not prompt that exceptions may occur, naturally, there is no logic for writing catch exceptions and logging.
The solution is to remove throws servletexception and oexception when declaring the service method.
This is an experience.
An error occurred while swallowing the servlet service method.