【发布时间】:2015-11-02 01:37:05
【问题描述】:
我正在超越异常。我尝试了许多 SO 的解决方案,但都没有奏效,因为其中大多数是针对 asp.net 的。
这是我的网络应用 web.xml 的一部分:
<servlet>
<servlet-name>MainPageServlet</servlet-name>
<servlet-class>servlets.MainPageServlet</servlet-class>
<multipart-config>
<!-- 10MB of files -->
<max-file-size>10485760B</max-file-size>
<!-- 10KB of form data -->
<max-request-size>10240B</max-request-size>
<!-- Buffer to disk over 512KB -->
<file-size-threshold>524288B</file-size-threshold>
</multipart-config>
</servlet>
<servlet-mapping>
<servlet-name>MainPageServlet</servlet-name>
<url-pattern>/mainPage/*</url-pattern>
</servlet-mapping>
这是我遇到的错误(http post 文件上传后的浏览器中):
[HttpException (0x80004005): Maximum request length exceeded.]
System.Web.HttpRequest.GetEntireRawContent() +9685979
System.Web.HttpRequest.get_InputStream() +41
Caucho.IIS.ResinHandler.DoHmux(HttpContext context) +138
Caucho.IIS.ResinHandler.ProcessRequest(HttpContext context) +334
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
文件有5,2Mb。
知道我应该在哪里设置最大文件大小吗?如您所见,如果我在 web.xml 中设置它,它就不起作用。
我正在使用resin java 服务器。
此外,当我在大小值 java IDE 抱怨后将“B”添加为 Bytes 时。但是,如果它不存在,我会收到此错误:
500 Servlet exception
WEB-INF/web.xml:29: com.caucho.server.dispatch.MultipartConfigImpl.setMaxFileSize():
com.caucho.config.types.Bytes.addText(): byte-valued expression `10485760'
must have units. '16B' for bytes, '16K' for kilobytes, '16M' for megabytes,
'16G' for gigabytes.
【问题讨论】:
标签: jsp jakarta-ee servlets resin