• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

problem using commons-fileupload lib

Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I'm trying to use the commons-fileupload lib from the jakarta project
I'm using Netbeans 3.6 as a development environment.
I thought I just put the jar file in the lib directory of my project and start using it, that's all I had to do with other libs
When I do that, and import org.apache.commons.filedownload into my servlet, I'm able to take the first step in using, create a FileUpload object. I can compile it fine. When I execute it it throws a

java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream

it happens in the constructor of FileUpload
I downloaded the source code so I could try to debug the problem.
Wasn't quite sure how to use the source code so I just threw the jar file out and incorporated the file download source code into the classes directory of my project and used it that way.
Now it works fine (in the development environment)
So I cary on and figure out how to do what I want to do and get it all working.
I bundle whole thing up in a war file and try to deploy it onto a a real tomcat server.
It throws the same exception

java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream

It throws this not when I try to run it but during deployment.
I search all the source code for file upload package and see no reference to ServletInputStream
What gives??
Any ideas??

Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hii Dave Robbins,

Do one thing, Just extract your JAR file. and after that try to execute your code. I think this might be helpful to u.
Dave Robbins
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmm, how strange
Last night I figured out that I can deploy my app (using the manager application which is part of tomcat) on a different machine and everything works fine. This morning I took your suggestion and stopped tomcat on the machine where I'm having trouble, copied the war file into the webapps dir, and restarted tomcat. It deployed properly and everything is fine.
So it looks like the problem is not my app but something with the manager application in tomcat. It's a new installation of tomcat and it's the first time I've set it up from scratch in a while, maybe I better go read the docs and see if I missed something. I thought all I had to do was unzip the package and add myself to tomcat-user.xml.

Anyway, thanx for the help!
I'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic