The problem of Tomcat accessing localhost 404 normally is solved


Today, I found a 404 error when configuring Tomcat to access the project home page. At first, I thought there was a problem with my project XML configuration, but it was wrong to adjust it for a long time. Later, I found that visiting localhost: 8080 also reported 404. This problem was serious, so I started a long debugging and finally succeeded! Record the final solution for similar problems in the future.

By consulting the great God in the Java group, I checked the webapps folder in the Tomcat folder and found that there was no my project in it, but I did deploy the project. So I checked my Tomcat server page and found that the Tomcat path in it was wrong, which was the default path in eclipse, so the deployment of Tomcat failed:

Wrong pathThe configuration is as follows:

Correct configurationShould be:

But after I did this, I found that Tomcat couldn’t get up directly and reportedThe file path cannot be foundMy mistake!

Then I decided to change my mind. First, I started Tomcat service without eclipse and used tomcat8 0’s startup Bat starts up. It is found that an error of refusing access was reported during the startup process. It feels likeAccess rightsThere was a problem, so I checked the data through Baidu and found that it was true, so I put itTomcat installation folder – > properties – > SecurityUsers are givenComplete controlClick OK to save and run startup again Bat, it started smoothly.

Then I go back and run Tomcat again. This time, no error will be reported. Tomcat starts successfully! Visit localhost: 8080 again and the page is displayed successfully!

Then visit my project page, and you will also visit it successfully! So far, the problemSuccessfully solved


Through this problem, we know that the problem may be in many aspects. We should divergent thinking to solve the problem. This time, we just checked the access address for a long time, and then found various configuration file errors of Tomcat. We didn’t expect that there will be problems with the path and permission of Tomcat. We should pay more attention in the future!

This is the end of this article about how to solve the problem of Tomcat’s normal access to localhost 404. For more information about Tomcat’s normal access to localhost 404, please search the previous articles of developeppaer or continue to browse the relevant articles below. I hope you will support developeppaer in the future!