简体   繁体   中英

Servlet gives 404 (Eclipse + Tomcat)

I'm learning with Lars Vogel's tutorial on http://www.vogella.com/articles/EclipseWTP/article.html and I'm stuck with a 404 error. So I created a Dynamic Web Project in Eclipse and then created FileDao.java and FileCounter.java according to the tutorial. And Eclipse generated a web.xml file for me, here it is:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>de.vogella.wtp.filecounter</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>
  <servlet>
    <description></description>
    <display-name>FileCounter</display-name>
    <servlet-name>FileCounter</servlet-name>
    <servlet-class>de.vogella.wtp.filecounter.servlets.FileCounter</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>FileCounter</servlet-name>
    <url-pattern>/FileCounter</url-pattern>
  </servlet-mapping>
</web-app>

I'm using Tomcat 6.0 and I chose Dynamic web module version 2.5 while creating the project.

What URL are you trying to access? ... Try

http://localhost:8080/<Include Your Project Name>/FileCounter

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM