Chapter 1 List of errors encountered during development, Chapter 1 Development

Source: Internet
Author: User

Chapter 1 List of errors encountered during development, Chapter 1 Development

List of errors encountered during development: (the list will be updated continuously)

1. http

404: The resource cannot be found. A strange problem in springmvc is listed.

Symptom:

  • When we execute a method in controller, assume that the path on the class is "/mq" and the path on the method is "/addLog", then the access path is "localhost: 8080/mq/addLog "(Note: The project name can be omitted). After access, the Error 404"/mq/addLog "cannot be found?

Analysis:

  • Why is the access path "/mq/addLog", but the error "/mq/addLog" is not found?

Cause:

  • The return type of the method is void. In the method body, no information is manually returned to the client, such as a json string. -- This is not allowed by spring.

Solution:

  • Change the return type of the method and return the corresponding data.
  • The method type is still void, and the method body returns information to the client manually

 

406: Indicates that the client browser does not accept the MIME type of the requested page.

Symptom:

  • Assume that in the above method, we return the boolean value in the method body and the return value of the method is also defined as boolean, and add @ ResponseBody to the method. At this time, this method is executed and 406 is returned.

Cause:

  • We added @ ResponseBody to the method body. In fact, our actual intention is to return json to the front-end, but we didn't configure the json converter, So we threw a 406

Solution:

  • Configure the json converter in the spring. xml file

 

Related Article

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.