回 帖 发 新 帖 刷新版面

主题:求助

错误显示:

HTTP Status 500 - 

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

exception 

javax.servlet.ServletException: Error allocating a servlet instance
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
    org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
    org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    java.lang.Thread.run(Thread.java:534)


root cause 

java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
    java.lang.ClassLoader.defineClass0(Native Method)
    java.lang.ClassLoader.defineClass(ClassLoader.java:539)
    java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
    java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
    java.net.URLClassLoader.access$100(URLClassLoader.java:55)
    java.net.URLClassLoader$1.run(URLClassLoader.java:194)
    java.security.AccessController.doPrivileged(Native Method)
    java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1255)
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
    org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
    org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    java.lang.Thread.run(Thread.java:534)





新加servlet:

package com.test;

import java.io.IOException;
import java.io.PrintWriter;
import com.test.AcountBean;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.*;

public class CheckAccount extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        System.out.print("dddddddddddddd");
        HttpSession session = request.getSession();
        AcountBean account = new AcountBean();
        
        String username = request.getParameter("username");
        String pwd = request.getParameter("pwd");
        account.setUsername(username);
        account.setPassword(pwd);        
        if( (username != null) && ( username.trim().equals("jsp")) )
        {    
            if( (pwd != null) && ( pwd.trim().equals("servlet")) )
            {
                System.out.println("success");
                session.setAttribute("account",account);
                String logon_suc= "success.jsp";
                response.sendRedirect(logon_suc);
                return;                            
            }            
        }        
        String logon_fail = "fail.jsp";
        response.sendRedirect(logon_fail);
        return;        
    }
    
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException 
            {
        doGet(request,response);
    }

}


不知道为什么会出现java.lang.NoClassDefFoundError:的错误。
我用的是JDK1.4,Tomcat5.0,谢谢

回复列表 (共1个回复)

沙发

看看你的web.xml文件,<servlet-class>属性配置是否正确?

我来回复

您尚未登录,请登录后再回复。点此登录或注册