servlet常见错误1
Posted codeDog123
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了servlet常见错误1相关的知识,希望对你有一定的参考价值。
后端JAVA程序报错:
java.lang.ClassCastException: DB.GetPerson cannot be cast to javax.servlet.Servlet at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:865) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:136) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
错误原因有可能是以下几种原因:
(1)后端的JAVA类声明的时候忘记extends HttpServlet
(2)Web.xml配置文件发生错误,往往是路径没有配置好
以上是关于servlet常见错误1的主要内容,如果未能解决你的问题,请参考以下文章
MySQL SELECT with LIKE in java Servlet MySQL 错误
service方法doGet方法doPost方法的区别和一些常见错误 Servlet的生命周期