问题
在Struts框架中进行一些I / O工作,但是在文件上传过程中遇到以下异常。
java.lang.NoClassDefFoundError:
org/apache/commons/io/output/DeferredFileOutputStream
在哪里下载Apache commons-io?
解
默认情况下,Struts使用Apache“ commons-io.jar ”进行文件上传。 要修复它,您必须将此库包含在项目依赖库文件夹中。
1.直接获得
从官方网站上获取“ commons-io.jar ” – http://commons.apache.org/io/
2.从Maven获取
首选方法是从Maven存储库中获取“ commons-io.jar ”
档案:pom.xml
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.4</version>
</dependency>
标签: Struts