404 exception is very common. Most of the cases are path errors, incorrect web.xml file mapping paths, server settings, servlet jar packages that are not imported or not released with the project, etc.
If the path is wrong, careful inspection can solve the problem.
This error will also be reported if the server is not set up properly. This is generally a problem encountered by novices when they first start learning. The server location of tomcat in eclipse must be set to use tomcat installation. Double-click the tomcat server in the eclipse interface to set it as shown in the figure:
If it is a problem with the servlet jar package, introduce the jar package through the build path, add the external jar file in the libraries tab, check the application in the order and export tab, and finally add it in the deployment and assessment option to indicate that tomcat is released Copy it to the WEB-INF/lib directory under the project.
But the problem I encountered today was not any of them. Come to think of it, I didn’t change anything. When I modified the code, I wanted to use another method to implement the upload function. Unexpectedly, after introducing a jar package and deleting it, a 404 appeared. Problem, very helpless.
The problem needs to be solved. After struggling for a long time, I finally found the problem: when deleting the jar package, I accidentally removed the webapp included in the release. This is no wonder that the path cannot be found in the report. See the picture.
Ok, problem solved.
Note: You also need to clean up tomcat and restart it, otherwise an exception will still be reported.