我在Eclipse Luna上使用Tomcat v8.0.15,它工作正常。后来,我安装了Netbeans;它自动安装了另一个Tomcat实例。我删除了其中一个。结果,tomcat停止了Eclipse的工作;每当我尝试启动tomcat时,都会出现此错误:
Caused by: java.lang.NoClassDefFoundError: HttpServletRequest
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2693)
at java.lang.Class.getDeclaredMethods(Class.java:1967)
at org.apache.catalina.util.Introspection.getDeclaredMethods(Introspection.java:127)
at org.apache.catalina.startup.WebAnnotationSet.loadMethodsAnnotation(WebAnnotationSet.java:273)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:133)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:334)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:774)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5095)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 more
Caused by: java.lang.ClassNotFoundException: HttpServletRequest
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1295)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1147)
... 20 more
答案 0 :(得分:2)
刚刚发生在我身上,这就是我如何解决它:在web.xml文件中,我试图将我的“servlet”标签中的servlet-name从“DefaultServlet”修改为“DispatcherServlet”,但是servlet我的“servlet-mapping”标签中的-name仍为“DefaultServlet”。我所要做的就是在各自的“servlet-name”标签中为“servlet”和“servlet-mapping”设置SAME servlet名称(所以“DispatcherServlet”)。一旦完成,它就成了一种魅力。