Why am I getting a NoClassDefFoundError on HttpServletRequest that is pointing to ServletFileUpload?

All 3rd party webapp libraries like Commons FileUpload belong in WEB-INF/lib of your webapp, not elsewhere. This exception can occur whenever you've placed it in JRE/lib or JRE/lib/ext.

All 3rd party webapp libraries like Commons FileUpload belong in /WEB-INF/lib of your webapp, not elsewhere. This exception can occur whenever you've placed it in JRE/lib or JRE/lib/ext. And indeed, as Bozho mentions, you need to ensure as well that you haven't moved/copied/duplicated any servletcontainer-specific libraries (which should be left untouched in Tomcat/lib) around in different places of the classpath.

But that should IMO not have resulted in this kind of exception. It's basically telling that the classloader which loaded the FileUpload API has totally no knowledge about the Servlet API. If you read the Tomcat classloading HOW-TO, then you'll see that the libraries in JRE/lib and JRE/lib/ext are loaded by a different classloader (bootstrap) than the ones in Tomcat/lib (common) and /WEB-INF/lib (webapp).

The bootstrap classloader has no knowledge about common and webapp libraries. It's the other way round. The common classloader has knowledge about the bootstrap classloader and the webapp classloader has knowledge about both.

Since the Servlet API is normally loaded by the common classloader, this can only mean that the FileUpload API was loaded by the bootstrap classloader. And this is wrong :).

Thank you for pointing out my error. I removed the 3rd party jars from the jre/lib/ext folder (I had copied them in there), and after a restart (not reinstall) of Tomcat, the process is back up and running as it was. – katura Jan 28 at 20:59 You're welcome.

– BalusC Jan 29 at 0:29.

This means that your servlet container does not have the servlet api. Take a clean installation of Tomcat and try to deploy there. First check that you have the servlet api jar in tomcat/lib.

And make sure you don't have it in webapps/yourapp/WEB-INF/lib.

Yes, the servlet-api. Jar is in c:\jakarta-tomcat\lib only. I'm running Tomcat 6.0.29.

– katura Jan 28 at 20:42 @katura - just try it on a fresh installation. Install = unzip. – Bozho Jan 28 at 20:43.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions