Struts2 文件上传 - 未找到依赖项的映射
Struts2 file upload - No mapping found for dependency
我正在使用 Struts 2.3.20.1 与 Commons 文件上传 1.3.1 和 Commons IO 2.4 上传 (CSV) 文件。当我尝试上传时,服务器日志中出现此错误:
ERROR [io.undertow.request] (default task-24) UT005023: Exception
handling request to /private/createDatasetFromCSV:
java.lang.RuntimeException: java.lang.RuntimeException:
java.lang.RuntimeException:
com.opensymphony.xwork2.inject.DependencyException:
com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException:
No mapping found for dependency [type=java.lang.String,
name='struts.multipart.bufferSize'] in public void
org.apache.struts2.dispatcher.multipart.JakartaStreamMultiPartRequest.setBufferSize(java.lang.String).
我遵循官方指南 here,创建 Action
class,使用 JSP 表单标签等等。
在 struts.xml
中,对于文件上传部分,我有:
<constant name="struts.multipart.maxSize" value="209715200" />
<constant name="struts.multipart.parser" value="jakarta-stream" />
Struts 的版本由于 WW-4466 应更新。
With WW-3025 there was a new config constant introduced: struts.multipart.bufferSize
Currently it is set as required and hence applications must specify it. The default value is always overridden.
-> should be required = false
Fix Version/s: 2.3.24
我正在使用 Struts 2.3.20.1 与 Commons 文件上传 1.3.1 和 Commons IO 2.4 上传 (CSV) 文件。当我尝试上传时,服务器日志中出现此错误:
ERROR [io.undertow.request] (default task-24) UT005023: Exception handling request to /private/createDatasetFromCSV: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='struts.multipart.bufferSize'] in public void org.apache.struts2.dispatcher.multipart.JakartaStreamMultiPartRequest.setBufferSize(java.lang.String).
我遵循官方指南 here,创建 Action
class,使用 JSP 表单标签等等。
在 struts.xml
中,对于文件上传部分,我有:
<constant name="struts.multipart.maxSize" value="209715200" />
<constant name="struts.multipart.parser" value="jakarta-stream" />
Struts 的版本由于 WW-4466 应更新。
With WW-3025 there was a new config constant introduced: struts.multipart.bufferSize
Currently it is set as required and hence applications must specify it. The default value is always overridden.
-> should be required = false
Fix Version/s: 2.3.24