Googled everything, but can't find solution for my problem.
When i'm trying to deploy my project to Tomcat, i have such errors in Tomcat log:
SEVERE: Error configuring application listener of class com.sun.faces.config.ConfigureListener
java.lang.NoClass开发者_开发知识库DefFoundError: javax/servlet/ServletRequestListener
I tried to deploy it from fresh Netbeans 6.8 to fresh Tomcat 6.0.26, but the problem is still there.
Servlet-api.jar is in the tomcat/lib folder. Tried to replace it with the newest, but problem is still there.
No compilation errors. Everything is correct.
Problem started suddenly. No code changes, no new jars added.
Help?
UPD: contents of WEB-INF/lib:
- hibernate3.jar
- hibernate-testing.jar
- quartz-1.7.2.jar
- quartz-all-1.7.2
- servlet-api-2.5-20081211
java.lang.NoClassDefFoundError: javax/servlet/ServletRequestListener
The javax.servlet.ServletRequestListener
is newly introduced since Servlet 2.4 API. That your environment cannot seem to find it can be caused by two things:
Either the
web.xml
is declared as Servlet 2.3 or older which forces the server to Servlet 2.3 compliance mode, or the server in question doesn't support Servlet 2.4 at all.Classpath is really, really messed up. You should never put/change/remove libraries in
JRE/lib
,JRE/lib/ext
orTomcat/lib
without understanding what you're doing. You should never put appserver-specific libraries inWebapp/WEB-INF/lib
because that doesn't make any sense.
To fix 1, ensure that your web.xml
is declared as at least Servlet 2.4. Preferably the newest which the server can support. Tomcat 6.0 supports Servlet 2.5, so declare web.xml
accordingly.
To fix 2, cleanup the classpath of all pollution. Invest some more time to learn more about the phenomeon "classpath". Handle it with care.
Tomcat doesn't ship with JSF libraries, so you have to include those in WEB-INF/lib. From the listing above it is obvious that your are missing those. For JSF2 go here.
Moreover you do not need servlet-api in WEB-INF/lib, it is a provided library.
精彩评论