Java 上传文件时出现错误“无法处理部分,因为未提供多部分配置”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24578680/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 13:10:09  来源:igfitidea点击:

Error "Unable to process parts as no multi-part configuration has been provided" when uploading file

javajspfile-uploadservlet-3.0tomcat8

提问by user3361891

I am trying to upload an file via a form in a JSP file, but I'm getting this error. The servlet already has the @MultipartConfig notation. I'm using servlet 3.0 and apache tomcat 8.

我正在尝试通过 JSP 文件中的表单上传文件,但出现此错误。servlet 已经具有@MultipartConfig 表示法。我正在使用 servlet 3.0 和 apache tomcat 8。

Error message:

错误信息:

java.lang.IllegalStateException: Unable to process parts as no multi-part configuration has been provided

on line

在线的

Collection<Part> parts = request.getParts();`

采纳答案by user3361891

I had to add

我不得不添加

allowCasualMultipartParsing="true"

on context tag inside context.xml

在 context.xml 中的上下文标签上