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

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>

About the Author

author image
mkyong
Founder of Mkyong.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 make a donation to these charities.

Comments

Leave a Reply

avatar
newest oldest most voted
Nguy?n Ng?c Th?nh
Guest
Nguy?n Ng?c Th?nh

thanks

sajjad
Guest
sajjad

This normaly happens when the commons-io.jar is missing fromyour class path , I had the same problem and below is how I got rid of it
http://javaiscoool.blogspot.com/2014/08/caused-by-javalangnoclassdeffounderror.html

prakash
Guest
prakash

at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1128)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1104)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1078)

prakash
Guest
prakash

could any one plese help me.
i am using commons-io-1.3.2.jar

someone
Guest
someone

thanks!

J.B.
Guest
J.B.

thanks!

Hao
Guest
Hao

Thank you very much.

Cristian
Guest
Cristian

It solved my problem.
Thanks.

Ty
Guest
Ty

How do I install or include apache commons io in my version of my Java JDK which I’m running on Windows 7? I’m trying to run a java applet to read in a URL and save the contents, and its giving me an apache commons io error (which is not installed).

Thanks,

Ty

Murli
Guest
Murli

HTTP Status 500 –

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet execution threw an exception

root cause

java.lang.Error: java.lang.RuntimeException: ‘\usr\crt\Documentum’ is an invalid value for the property dfc.data.dir
com.documentum.fc.client.DfClientSupport.(DfClientSupport.java:115)
com.documentum.fc.client.DfClient.(DfClient.java:32)
com.documentum.fc.client.DfClient.getLocalClientEx(DfClient.java:71)
com.documentum.fc.client.DfClient.getLocalClient(DfClient.java:57)
itgi.hcl.help.SearchDocument.(SearchDocument.java:42)
itgi.hcl.action.PolicySearchAction.searchDocumentum(PolicySearchAction.java:271)
itgi.hcl.action.PolicySearchAction.execute(PolicySearchAction.java:58)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.29 logs.
Apache Tomcat/6.0.29