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 }}