我正在尝试部署我没有编写的战争,并且在我的日志中收到此错误:
java.lang.NoClassDefFoundError: HttpSessionListener
我知道 HttpSessionListener 存在于servlet-api.jar中,它位于 tomcat(我的应用服务器)的 lib 目录中。
我尝试将 servlet-api.jar 包含在战争的 WEB-INF/lib 文件夹中,但日志对我大喊大叫:
INFO: validateJarFile(/home/test/apache-tomcat-6.0.18/webapps/test/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
互联网声称您不必将该类包含在您的 lib 文件夹中。
编辑: 我从 web.xml 中删除了有问题的侦听器(导致上述问题),因为它看起来并不重要。这揭示了更多错误:
java.lang.Error: Unresolved compilation problem:
The type javax.servlet.FilterChain cannot be resolved. It is indirectly referenced from required .class files
我错过了什么?