2018-05-15 16:03:55,758 ERROR [org.apache.struts2.dispatcher.multipart.MultiPartRequest] - <org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. c:\upload_37b61c0a_16362cf4b81__7fd8_00000000.tmp (拒绝访问。)>
2018-05-15 16:03:55,789 ERROR [org.apache.struts2.interceptor.FileUploadInterceptor] - <Processing of multipart/form-data request failed. c:\upload_37b61c0a_16362cf4b81__7fd8_00000000.tmp (拒绝访问。)>
2018-05-15 16:03:55,813 ERROR [org.apache.struts2.dispatcher.Dispatcher] - <Could not find action or result>
No result defined for action cn.com.cis.claim.common.regist.web.CommonRegistAction and result input - action - file:/G:/claim_7002/modules/webapp/WEB-INF/csses/struts/common/struts-regist-common.xml:143:2
别人写的上传文件的代码,我拉取下来,点击上传文件提交表单时,不进入相应的Action方法,而是直接返回result=“input”,页面上述错误。
最终发现问题的原因是struts.xml中有一个用于存放临时文件的路径:
<constant name="struts.xslt.nocache" value="false" />
<constant name="struts.multipart.saveDir" value="c:/" />
有些电脑可能c盘没有访问权限,改成其他路径即可:
<constant name="struts.xslt.nocache" value="false" />
<constant name="struts.multipart.saveDir" value="d:/" />