Problem

Doing some I/O works in Struts framework, but hits following exception in file upload process.

java.lang.NoClassDefFoundError: 
        org/apache/commons/io/output/DeferredFileOutputStream

Where to download the Apache commons-io?

Solution

By default, Struts is using Apache “commons-io.jar” for its file upload process. To fix it, you have to include this library into your project dependency library folder.

1. Get Directly

Get “commons-io.jar” from official website – http://commons.apache.org/io/

2. Get From Maven

The prefer way is get the “commons-io.jar” from Maven repository

File : pom.xml

   <dependency>
      <groupId>commons-io</groupId>
	  <artifactId>commons-io</artifactId>
      <version>1.4</version>
    </dependency>
Tags :
Founder of Mkyong.com and HostingCompass.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider making a donation to this charity, thanks.

Related Posts

Popular Posts