[Resolved]tomcat started successfully in eclipse but displayed a 404 error on Access?

Source: Internet
Author: User
Tags xmlns

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.


Related Article

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.