0
votes

I use commons-fileupload-1.1.1 and commons-io-1.3.2 to upload/download files in a web application with java 6. In localhost, it runs correctly because I have the 2 jars in my lib (server\default\lib) (I use jboss 4).

When I deploy the application in the server, I have an exception when I try to upload/download files:

java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUploadException

The one difference between localhost and the server is: in the server, I have not the 2 jars.

When I change the classpath of the project and I add the two jars, I deploy the application --> I have the same exception.

Any suggestions?

1
If the class wasn't in your classpath you'd be getting a ClassNotFoundException. You're getting a NoClassDefFoundError which is usually misleading. It's probably failing due to an error in a static initializer on another referenced class.jgitter
@jgitter , I think you are inversing the two: stackoverflow.com/questions/1457863/…tom
I don't think I am Tom.jgitter
@tom your linked question actually confirms what I said, it just goes more in depth.jgitter

1 Answers

1
votes

There are 2 ways of going about this:

  1. Application specific: Add your 2 jars in your project's WEB-INF/lib folder, build your project and deploy.
  2. Alternatively, try the JBOSS_4_AS\server\all\lib folder. That way, all applications deployed in your JBOSS 4 Application server can see the 2 jars.

I hope this helps.