尝试访问servlet时获取NoClassDefFoundError

时间:2011-04-13 19:12:39

标签: servlets compiler-errors

当我尝试使用GET将一些数据发送到servlet时,我收到此错误。我用netbeans编译了servlet类,包括需要的javax.servlet.jar,它可能与它有关。

错误:500 位置:/ myapp / firstCookieDemo 内部Servlet错误:

java.lang.NoClassDefFoundError: CookieServlet (wrong name: server/CookieServlet)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at org.apache.tomcat.util.depend.DependClassLoader12Impl.defineClassCompat(DependClassLoader12.java:141)
    at org.apache.tomcat.util.depend.DependClassLoader12Impl.loadClassInternal1(DependClassLoader12.java:233)
    at org.apache.tomcat.util.depend.DependClassLoader12Impl$1.run(DependClassLoader12.java:78)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.tomcat.util.depend.DependClassLoader12Impl.loadClass(DependClassLoader12.java:76)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at org.apache.tomcat.facade.ServletHandler.getServlet(ServletHandler.java:307)
    at org.apache.tomcat.facade.ServletHandler.preInit(ServletHandler.java:378)
    at org.apache.tomcat.facade.ServletHandler.init(ServletHandler.java:192)
    at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:423)
    at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:874)
    at org.apache.tomcat.core.ContextManager.service(ContextManager.java:790)
    at org.apache.coyote.tomcat3.Tomcat3Adapter.service(Tomcat3Adapter.java:64)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
    at java.lang.Thread.run(Thread.java:662)

0 个答案:

没有答案