日期:2014-05-17  浏览次数:20815 次

eclipse开发servlet的时候错误404
刚学Servlet 用Eclipse写了个很简单的Servlet 在eclipse中正常启动了tomcat 但是 在网站中输入http://localhost:7878/ServletDemo2/MyFirstServlet的时候显示404错误
下面是控制台的结果
2012-7-26 20:35:11 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.6.0\jre\bin;C:/Program Files/Java/jdk1.6.0/bin/../jre/bin/client;C:/Program Files/Java/jdk1.6.0/bin/../jre/bin;C:/Program Files/Java/jdk1.6.0/bin/../jre/lib/i386;E:\oracle\product\10.2.0\db_1\bin;C:\Program Files\Java\jdk1.6.0\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Thunder Network\KanKan\Codecs;F:\实验 课程设计\新建文件夹\bin;D:\QQPCMgr\6.6.2136.201;E:\sjsas\bin;C:\Program Files\Java\jdk1.6.0\bin;F:\sb\android-sdk-windows\tools;E:\J2EE_Eclipse\eclipse;
2012-7-26 20:35:11 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-7878
2012-7-26 20:35:11 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 634 ms
2012-7-26 20:35:11 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2012-7-26 20:35:11 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.35
2012-7-26 20:35:11 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(E:\Tomcat\apache-tomcat-6_win7\webapps\ServletDemo2\WebRoot\WEB-INF\lib\javaee.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
2012-7-26 20:35:11 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor host-manager.xml
2012-7-26 20:35:12 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor manager.xml
2012-7-26 20:35:12 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory docs
2012-7-26 20:35:12 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory examples
2012-7-26 20:35:12 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2012-7-26 20:35:12 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2012-7-26 20:35:12 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory PB_JSF
2012-7-26 20:35:12 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory PB_JSP
2012-7-26 20:35:12 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory ROOT
2012-7-26 20:35:12 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory Servlet
2012-7-26 20:35:12 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory ServletDemo
2012-7-26 20:35:12 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory ServletDemo2
2012-7-26 20:35:12 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-7878
2012-7-26 20:35:12 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2012-7-26 20:35:12 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/32 config=null
2012-7-26 20:35:12 org.apache.catalina.startup.Catalina start
信息: Server startup in 1270 ms

下面是web.xml的文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi=&qu