NoClassDefFound error when using Commons File Upload library
Joined: Mar 22, 2011
I have developed a simple file upload servlet in Eclipse, all works fine using test version of a Java EE web project running Tomcat V7.
When I have switched to my non testing version project using Tomcat v6 (it needs to be this v as specified in project requirements) the script will not run. After hours looking at this I have found the following:
1) The Commons File Upload library was not saved as part of the v7 project - I have now added this to the build path saved within the Tomcat 6 folder (should this in-fact be saved in WEB-INF/lib or does this not really matter?)
2) Eclipse is prompting me to point to the tomcat-coyote.jar file in my Tomcat V7 folder
3) Following the above fix from Eclipse causes a java.lang.NoClassDefFoundError - this makes sense as I clearly don't want to be using two sets of files for V6/V7
The odd thing is that out of the following class imports:
The first two are fine but the second two cause issues.
It seems that compiling on v7 and switching to v6 to execute has caused these issues, is it that DiskFileItemFactory and ServletFileUpload in the Commons File Upload library are not supported on Tomcat v6 or is there another explanation?
Any pointers would be much appreciated, thanks in advance!