javax.servlet.ServletException: Error instantiating servlet class [com.xxx.xxxservlet]的解决办法

今天在写一个servlet中创建了servlet,改了名字,启动Tomcat访问时出现了如下异常:
javax.servlet.ServletException: Error instantiating servlet class [com.java.servlet.demo1servlet]
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:412)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1385)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Unknown Source)

第一反应是web.xml没跟着修改servlet名,打开web.xml果然是没改,导致两边servlet-name不一致,不能映射过去,手动修改后正常。

你可能感兴趣的:(Java,servlet)