This article is written to beginners, but also to their own later need to redeploy the project as a reference, if it happens to help you, please feedback to me, increase my growing process to share the momentum.
There are a lot of procedures on the internet about Tomcat installation and environment variables, and I will not repeat them.
issue : Tomcat can successfully access localhost:8080 when testing whether the installation is successful. However, when Tomcat is set up in Eclipse, 404 pages appear when you deploy the project.
The author has done the following two main actions "resolved this issue":
1, many tutorials (books, videos) to guide you to configure the corresponding parameters in Web. XML,
My tomcat is 8.0.23.
Both the JDK and JRE environments are 1.8.0
is not going to manually configure Web. XML
It may be that the newest Tomcat and eclipse no longer need us to do this work, but add to the superfluous.
My Web. XML file code is as follows:
<?xml version= "1.0" encoding= "UTF-8"?> <web-app
xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance "Xmlns=" Http://xmlns.jcp.org/xml/ns/javaee "xsi:schemalocation=" Http://xmlns.jcp.org/xml/ns/javaee http// Xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd "id=" webapp_id "version=" 3.1 ">
<display-name>firstweb </display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</ welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
2, the above setup is complete, after deployment in Eclipse, still display 404 error.
has been a long time without fruit, it may be the cause of the 404 error is too many.
1) After repeated attempts to discover, before deployment, delete the current project (see figure below).
2) and stop Tomcat running (right-click--stop).
3) open only the servlet files that we have edited now (it feels like this is the crux of the problem, because I opened it in the Web. xml file several times each time), just run it.
I've already deployed it, so let's try this method.