An error occurred while swallowing the servlet service method.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.