• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NoClassDefFound error when using Commons File Upload library

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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!

Regards,
Paul

 
Ranch Hand
Posts: 113
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

You need to put Commons-IO jar as well. Fileupload jar has a dependency on it.
 
Paul Featherstone
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Souvic, this worked..hurray!
 
reply
    Bookmark Topic Watch Topic
  • New Topic