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>
Tags :

About the Author

mkyong
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 make a donation to these charities.

Comments

  • Pingback: Blue Coaster33()

  • 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

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

  • someone

    thanks!

  • J.B.

    thanks!

  • http://[email protected] Hao

    Thank you very much.

  • Cristian

    It solved my problem.
    Thanks.

    • 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

    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