所有
需要您对以下错误提供宝贵的指导。我正在尝试上传大小超过10MB的文件。
服务器:wildfly 10.1.0 Final 文件上传库1.3(apache commons fileupload)
我尝试了以下但没有成功。 一个。将max-post-size更改为300mb 湾还添加到web.xml
<multipart-config>
<max-file-size>314572800</max-file-size>
<max-request-size>314572800</max-request-size>
</multipart-config>
下面的Stacktrace
java.nio.channels.ClosedChannelException
[ERROR] 2017-07-27 08:05:06,586 stderr - at io.undertow.conduits.ChunkedStreamSourceConduit.read(ChunkedStreamSourceConduit.java:181)
[ERROR] 2017-07-27 08:05:06,587 stderr - at org.xnio.conduits.ConduitStreamSourceChannel.read(ConduitStreamSourceChannel.java:127)
[ERROR] 2017-07-27 08:05:06,587 stderr - at io.undertow.channels.DetachableStreamSourceChannel.read(DetachableStreamSourceChannel.java:209)
[ERROR] 2017-07-27 08:05:06,588 stderr - at io.undertow.server.HttpServerExchange$ReadDispatchChannel.read(HttpServerExchange.java:2265)
[ERROR] 2017-07-27 08:05:06,588 stderr - at org.xnio.channels.Channels.readBlocking(Channels.java:294)
[ERROR] 2017-07-27 08:05:06,589 stderr - at io.undertow.servlet.spec.ServletInputStreamImpl.readIntoBuffer(ServletInputStreamImpl.java:168)
[ERROR] 2017-07-27 08:05:06,589 stderr - at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:144)
[ERROR] 2017-07-27 08:05:06,590 stderr - at org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:997)
[ERROR] 2017-07-27 08:05:06,590 stderr - at org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:901)
[ERROR] 2017-07-27 08:05:06,591 stderr - at java.io.InputStream.read(InputStream.java:101)
[ERROR] 2017-07-27 08:05:06,591 stderr - at org.apache.commons.fileupload.util.Streams.copy(Streams.java:101)
[ERROR] 2017-07-27 08:05:06,592 stderr - at org.apache.commons.fileupload.util.Streams.copy(Streams.java:70)
[ERROR] 2017-07-27 08:05:06,592 stderr - at org.apache.commons.fileupload.MultipartStream.readBodyData(MultipartStream.java:589)
[ERROR] 2017-07-27 08:05:06,593 stderr - at org.apache.commons.fileupload.MultipartStream.discardBodyData(MultipartStream.java:613)
[ERROR] 2017-07-27 08:05:06,594 stderr - at org.apache.commons.fileupload.MultipartStream.skipPreamble(MultipartStream.java:630)
[ERROR] 2017-07-27 08:05:06,594 stderr - at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.findNextItem(FileUploadBase.java:1018)
[ERROR] 2017-07-27 08:05:06,595 stderr - at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:998)
[ERROR] 2017-07-27 08:05:06,595 stderr - at org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:310)
[ERROR] 2017-07-27 08:05:06,596 stderr - at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:334)
[ERROR] 2017-07-27 08:05:06,596 stderr - at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:115)
[ERROR] 2017-07-27 08:05:06,597 stderr - at com.xx.yy.zz.servlet.auth.FileUploader.doPost(FileUploader.java:181)
[ERROR] 2017-07-27 08:05:06,597 stderr - at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
[ERROR] 2017-07-27 08:05:06,598 stderr - at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
答案 0 :(得分:2)
我遇到类似Wildfly 10和apache commons-fileupload 1.3的问题。但在我的情况下,设置max-post-size就足够了。您是否在standalone配置中为standalone.xml(或域)设置了max-post-size以获得正确的http或https侦听器?示例如下:
<http-listener max-post-size="304857600" name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
<https-listener max-post-size="304857600" name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
默认值为10MB。您可以在Wildfly / docs / schema / wildfly-undertow_3_1.xsd
中查看它