javax.servlet.ServletException:java.lang.NoClassDefFoundError的:组织/阿帕奇/公/ IO /输出/ DeferredFileOutputStream [英] javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream

查看:174
本文介绍了javax.servlet.ServletException:java.lang.NoClassDefFoundError的:组织/阿帕奇/公/ IO /输出/ DeferredFileOutputStream的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用JSP上传文件,我得到了错误的
org.apache.jasper.JasperException:发生异常处理JSP页面 /upload.jsp 在第31行

  28:upload.setSizeMax(MAXFILESIZE);
29:尝试{
30://解析获取文件的项目的请求。
31:列表fileItems = upload.parseRequest(请求);
32:
33://处理上传的文件项
34:迭代器I = fileItems.iterator();

例外,我得到的是:

  javax.servlet.ServletException:java.lang.NoClassDefFoundError的:组织/阿帕奇/公/ IO /输出/ DeferredFileOutputStream
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:912)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841)
    org.apache.jsp.upload_jsp._jspService(upload_jsp.java:154)


解决方案

  

java.lang.NoClassDefFoundError的:组织/阿帕奇/公/ IO /输出/ DeferredFileOutputStream


这意味着,所提到的类中的web应用程序的运行时类路径丢失。作为包名提示,这是 Apache的百科全书IO 的一部分。您需要下载 zip文件包含二进制JAR文件,解压缩和然后删除公地io.jar 在你的webapp的 / WEB-INF / lib目录文件夹,用<$ C沿$ C>公地fileupload.jar ,你应该已经在那里。

待办事项的不可以把它放在Tomcat的 / lib目录同时具有公地fileupload.jar 在Web应用程序的 / WEB-INF / lib目录。在项目的构建路径的设置做的不可以反复折腾。刚落,两个JAR文件在Web应用程序的 / WEB-INF / lib目录,你应该准备就绪。

参见:


无关的具体问题,爪哇code没有在JSP文件属于。它属于Java类。它的时间来学习如何创建和使用的servlet 为时已晚了。

I am trying to upload a file using JSP and I got the error as org.apache.jasper.JasperException: An exception occurred processing JSP page /upload.jsp at line 31

28:       upload.setSizeMax( maxFileSize );   
29:       try{   
30:          // Parse the request to get file items.  
31:          List fileItems = upload.parseRequest(request);  
32:   
33:          // Process the uploaded file items  
34:          Iterator i = fileItems.iterator();    

exception that I got is:

javax.servlet.ServletException: java.lang.NoClassDefFoundError:    org/apache/commons/io/output/DeferredFileOutputStream  
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:912)  
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841)  
    org.apache.jsp.upload_jsp._jspService(upload_jsp.java:154)  

解决方案

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

This means that the mentioned class is missing in webapp's runtime classpath. As the package name hints, it's part of Apache Commons IO. You need to download the zip file containing the binary JARs, extract it and then drop commons-io.jar in your webapp's /WEB-INF/lib folder, along with the commons-fileupload.jar which you should already have there.

Do not put it in Tomcat's /lib while having the commons-fileupload.jar in webapp's /WEB-INF/lib. Do not fiddle around in project's Build Path setting. Just drop the two JARs in webapp's /WEB-INF/lib and you should be all set.

See also:


Unrelated to the concrete problem, Java code doesn't belong in JSP files. It belongs in Java classes. It's time to learn how to create and use servlets before it's too late.

这篇关于javax.servlet.ServletException:java.lang.NoClassDefFoundError的:组织/阿帕奇/公/ IO /输出/ DeferredFileOutputStream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆