Spring MVC 404 Not Found no error log solution, mvc404

Source: Internet
Author: User

Spring MVC 404 Not Found no error log solution, mvc404

Scenario Description: Use Spring MVC Framework to store data, and use firebug tracking in firefox to find 404 Not Found.

 

Analysis: no error logs are printed in the background and the problem cannot be analyzed.


Solution (provided by my friends)

Add a red configuration file to the spring-mvc.xml configuration file.


Add the ControllerAdviceTest. java file under controller (Note: it must be under controller because component-scan is configured in the spring-mvc.xml)



Run the following error log in the background again:


It is obvious that there is a problem with the object name, and the problem is solved now. Attachment: Include the source code of ControllerAdviceTest. java (can't I add a compressed package? Modify the bag name)

Package com. snake. controller; import org. apache. log4j. logger; import org. springframework. http. httpStatus; import org. springframework. web. bind. annotation. controllerAdvice; import org. springframework. web. bind. annotation. exceptionHandler; import org. springframework. web. bind. annotation. responseStatus; import org. springframework. web. context. request. nativeWebRequest; @ ControllerAdvicepublic class ControllerAdviceTest {protected static Logger logger = Logger. getLogger (ControllerAdviceTest. class); @ ExceptionHandler (Exception. class) @ ResponseStatus (HttpStatus. BAD_REQUEST) public String processUnauthenticatedException (NativeWebRequest request, Exception e) {logger. error (e. getMessage (); return "viewName"; // return a logical view name }}



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.