日期:2014-05-18  浏览次数:20715 次

求救!Servlet运行出错!Wrapper cannot find servlet class 我快疯了
编写了一个简单的Servlet,HelloWorld.java
package   test;

import   java.io.*;
import   java.text.*;
import   java.util.*;
import   javax.servlet.*;
import   javax.servlet.http.*;

public   class   HelloWorld   extends   HttpServlet
{
public   void   doGet(HttpServletRequest   request,HttpServletResponse   response)
throws   IOException,ServletException
{
response.setContentType( "text/html ");
PrintWriter   out   =   response.getWriter(); out.println( " <html> ");
out.println( " <head> ");
                  out.println( " <title> HelloWorld </title> ");
out.println( " </head> ")
out.println( " <body> HelloWorld </body> ");
out.println( " </html> ");
}
}
环境变量
JAVA_HOME=C:\j2sdk1.4.2_13
CATALINA_HOME=C:\Program   Files\Apache   Software   Foundation\Tomcat   5.0
CLASSPATH=C:\j2sdk1.4.2_13\lib\dt.jar;C:\j2sdk1.4.2_13\lib\tool.jar;C:\j2sdk1.4.2_13\lib\tools.jar;C:\Program   Files\Apache   Software   Foundation\Tomcat   5.0\common\lib\servlet-api.jar;C:\Program   Files\Apache   Software   Foundation\Tomcat   5.0\common\lib\jsp-api.jar

Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\j2sdk1.4.2_13\bin

将编译完后的HelloWorld.class放入%CATLINA_HOME%\webapps\servlet\WEB-INF\classses\test\目录下
并且修改了servlet\WEB-INF\下的web.xml
<?xml   version= "1.0 "   encoding= "ISO-8859-1 "?>

<!DOCTYPE   web-app
        PUBLIC   "-//Sun   Microsystems,   Inc.//DTD   Web   Application   2.3//EN "
        "http://java.sun.com/dtd/web-app_2_3.dtd ">

<web-app>
    <display-name> my   program </display-name>
    <description>
          test
    </description>
   
    <servlet>
    <servlet-name> HelloWorld </servlet-name>
    <display-name> HelloWorld </display-name>
    <description> A   test   Servlet </description>
    <servlet-class> test.HelloWorld </servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name> HelloWorld </servlet-name>
    <url-pattern> /HelloWorld </url-pattern>
    </servlet-mapping>
</web-app>
重新启动Tomcat,但是在浏览器中输入http://127.0.0.1:8080/webapps/servlet/HelloWorld
出现下面的错误
type   Exception   report

message  

description   The   server   encountered   an   internal   error   ()   that   prevented   it   from   fulfilling   this   request.

exception  

javax.servlet.ServletException:   Wrapper   cannot   fi