views:

150

answers:

2

Hi!

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.NoClassDefFoundError: 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
A: 

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.

jarekrozanski
jsf-api.jar, jsf-impl.jar and jsf-facelets.jar are inside tomcat_home/lib directory. This jars are also attached to project for compile. servlet-api.jar removed from web-inf/lib. Problem still there.
Yurish
Ok, but you should remove servlet-api from WEB-INF/lib. Otherwise you have two jars with the same classes.
jarekrozanski
Removed all servlet-api jars from my build path. Problem is still there. serlet-api is present in tomcat/lib folder. Can't get the reason, why it is so? Yesterday i could control tomcat from netbeans(start and stop), but now i even don't see it`s status inside servers tab. I see it there, but no status, when it is running.
Yurish
You can narrow down problem by exporting/packaging your project to WAR and deploying it to the same Tomcat without Netbeans. If it works, then it is purely Netbeans related and you could solve it by reinstalling Tomcat server within Netbeans itself (add new server). Good luck!
jarekrozanski
+2  A: 
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:

  1. 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.

  2. Classpath is really, really messed up. You should never put/change/remove libraries in JRE/lib, JRE/lib/ext or Tomcat/lib without understanding what you're doing. You should never put appserver-specific libraries in Webapp/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.

BalusC
Tried to run tomcat itself. Unpacked fresh instance, run in cmd "catalina run". Server started, but in logs are the same error. I can't even open Tomcat start page or Tomcat manager. No jars added to tomcat/lib. Just started it. Advices?
Yurish
Then it means that the pollution is in the `JRE/lib` or `JRE/lib/ext`.
BalusC
Found there some jsf libraries. Strange thing. I haven't put them there. Deleted. Tomcat is starting. Thank`s! Problem itself solved. Now i have another problem, but first of all i`ll try myself. =]
Yurish
Well done and you're welcome.
BalusC