当我尝试在Eclipse上运行动态Web项目时收到错误消息。
文件web.xml位于WebContent / WEB-INF。
下servlet已保存在Java Resources / src下,名称为" com.zestedesavoir.Test"并且servlet被命名为" Test.java"。
有servlet代码:
package com.zestedesavoir.servlets;
import javax.servlet.http.HttpServlet;
public class Test extends HttpServlet {
}
我运行http://localhost:8080/test/toto
时收到的错误消息下方=============================================== ==================
Jan 16, 2015 10:32:01 AM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet Test as unavailable
Jan 16, 2015 10:32:01 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet Test
java.lang.ClassNotFoundException: com.zestedesavoir.servlets.Test>
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1295)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1147)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:520)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:501)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:120)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:827)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1556)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1513)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
我多次尝试删除servlet并创建一个新的但我仍然收到相同的错误消息。
感谢您的帮助
答案 0 :(得分:0)
您是否注意到班级名称末尾有一个奇怪的>
字符?
该杂散字符位于堆栈跟踪中的异常消息和HTTP响应消息中(显然)。
在你的webapp配置的某个地方,你必须错误输入一个类名。我先检查“web.xml”文件,但它可能在其他地方。