为了账号安全,请及时绑定邮箱和手机立即绑定

Linux下SpringMVC无法上传文件

Linux下SpringMVC无法上传文件

E_mKs3178303 2018-04-14 14:06:56
后台写好上传代码,本地调试正常,发现放到Linux上就报错org.springframework.web.multipart.support.MissingServletRequestPartException: Required request part 'file' is not present    at org.springframework.web.method.annotation.RequestParamMethodArgumentResolver.handleMissingValue(RequestParamMethodArgumentResolver.java:193)    at org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveArgument(AbstractNamedValueMethodArgumentResolver.java:109)    at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:121)    at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:158)    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:128)    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)    at com.platform.xss.XssFilter.doFilter(XssFilter.java:43)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)    at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)    at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)    at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)    at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)    at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)    at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)    at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)    at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)    at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)    at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:341)    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:495)    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:767)    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1354)    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)    at java.lang.Thread.run(Thread.java:745)
查看完整描述

1 回答

?
cxxyjsj

TA贡献119条经验 获得超22个赞

从报错第一行来看应该是file参数没传递到后台

查看完整回答
反对 回复 2018-04-14
  • E_mKs3178303
    E_mKs3178303
    在windows下是正常的
  • cxxyjsj
    cxxyjsj
    F12打开前端控制台,看下提交的参数有没有file, 如果有,那么检查下linux临时目录权限有没问题。
  • 慕桂英0739128
    慕桂英0739128
    请问问题解决了么。。我也有这个问题,但是/tmp文件夹有权限啊。。
  • 1 回答
  • 0 关注
  • 2008 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信