2015-07-06 91 views
0

我使用Jetty容器部署了Spring/Mvc,最近在生產中我無法上載文件,失敗的原因是/ tmp目錄丟失。Jetty tmp目錄在生產中間歇性丟失 -/tmp/jetty

我重新啓動了應用程序來修復它,但它隨機再次丟失。

以下是我在上傳過程中遇到的異常情況。

2015-07-03 06:58:22,440|qtp1182373735-15|INFO |o.s.s.ldap.SpringSecurityLdapTemplate: Ignoring PartialResultException 
2015-07-03 06:58:22,494|qtp1182373735-15|ERROR|c.n.b.w.e.GlobalControllerExceptionHandler: Could not parse multipart servlet request; nested exception is org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. /tmp/jetty-0.0.0.0-8999-booster-_booster-any-1796299670201591887.dir/upload_5a19924c_c3a7_4f1f_8a46_702d1faa4c1a_00000001.tmp (No such file or directory) 
org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. /tmp/jetty-0.0.0.0-8999-booster-_booster-any-1796299670201591887.dir/upload_5a19924c_c3a7_4f1f_8a46_702d1faa4c1a_00000001.tmp (No such file or directory) 
    at org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:165) ~[spring-web-4.0.5.RELEASE.jar:4.0.5.RELEASE] 
    at org.springframework.web.multipart.commons.CommonsMultipartResolver.resolveMultipart(CommonsMultipartResolver.java:142) ~[spring-web-4.0.5.RELEASE.jar:4.0.5.RELEASE] 
    at org.springframework.web.servlet.DispatcherServlet.checkMultipart(DispatcherServlet.java:1067) ~[spring-webmvc-4.0.5.RELEASE.jar:4.0.5.RELEASE] 
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:906) ~[spring-webmvc-4.0.5.RELEASE.jar:4.0.5.RELEASE] 
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870) ~[spring-webmvc-4.0.5.RELEASE.jar:4.0.5.RELEASE] 
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) [spring-webmvc-4.0.5.RELEASE.jar:4.0.5.RELEASE] 
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863) [spring-webmvc-4.0.5.RELEASE.jar:4.0.5.RELEASE] 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) [javax.servlet-api-3.1.0.jar:3.1.0] 
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) [spring-webmvc-4.0.5.RELEASE.jar:4.0.5.RELEASE] 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [javax.servlet-api-3.1.0.jar:3.1.0] 
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:711) [jetty-servlet-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1644) [jetty-servlet-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.springframework.security.oauth2.client.filter.OAuth2ClientContextFilter.doFilter(OAuth2ClientContextFilter.java:57) [spring-security-oauth2-2.0.2.RELEASE.jar:na] 
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1632) [jetty-servlet-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE] 
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE] 
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE] 
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE] 
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE] 
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE] 
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE] 
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE] 
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE] 
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) [spring-security-web-3.2.4.RELEASE.jar:3.2.4.RELEASE] 
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344) [spring-web-4.0.5.RELEASE.jar:4.0.5.RELEASE] 
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) [spring-web-4.0.5.RELEASE.jar:4.0.5.RELEASE] 
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1632) [jetty-servlet-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-4.0.5.RELEASE.jar:4.0.5.RELEASE] 
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.0.5.RELEASE.jar:4.0.5.RELEASE] 
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1632) [jetty-servlet-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:97) [metrics-servlet-3.0.2.jar:3.0.2] 
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1624) [jetty-servlet-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:550) [jetty-servlet-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:568) [jetty-security-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221) [jetty-server-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1112) [jetty-server-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:479) [jetty-servlet-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183) [jetty-server-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1046) [jetty-server-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:199) [jetty-server-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109) [jetty-server-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [jetty-server-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.server.Server.handle(Server.java:462) [jetty-server-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:281) [jetty-server-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:232) [jetty-server-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.io.AbstractConnection$1.run(AbstractConnection.java:505) [jetty-io-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607) [jetty-util-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536) [jetty-util-9.1.3.v20140225.jar:9.1.3.v20140225] 
    at java.lang.Thread.run(Thread.java:724) [na:1.7.0_40] 
Caused by: org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. /tmp/jetty-0.0.0.0-8999-booster-_booster-any-1796299670201591887.dir/upload_5a19924c_c3a7_4f1f_8a46_702d1faa4c1a_00000001.tmp (No such file or directory) 
    at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:351) ~[commons-fileupload-1.3.1.jar:1.3.1] 
    at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:115) ~[commons-fileupload-1.3.1.jar:1.3.1] 
    at org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:158) ~[spring-web-4.0.5.RELEASE.jar:4.0.5.RELEASE] 
    ... 56 common frames omitted 
Caused by: java.io.FileNotFoundException: /tmp/jetty-0.0.0.0-8999-booster-_booster-any-1796299670201591887.dir/upload_5a19924c_c3a7_4f1f_8a46_702d1faa4c1a_00000001.tmp (No such file or directory) 
    at java.io.FileOutputStream.open(Native Method) ~[na:1.7.0_40] 
    at java.io.FileOutputStream.<init>(FileOutputStream.java:221) ~[na:1.7.0_40] 
    at java.io.FileOutputStream.<init>(FileOutputStream.java:171) ~[na:1.7.0_40] 
    at org.apache.commons.io.output.DeferredFileOutputStream.thresholdReached(DeferredFileOutputStream.java:178) ~[commons-io-2.4.jar:2.4] 
    at org.apache.commons.io.output.ThresholdingOutputStream.checkThreshold(ThresholdingOutputStream.java:224) ~[commons-io-2.4.jar:2.4] 
    at org.apache.commons.io.output.ThresholdingOutputStream.write(ThresholdingOutputStream.java:128) ~[commons-io-2.4.jar:2.4] 
    at org.apache.commons.fileupload.util.Streams.copy(Streams.java:107) ~[commons-fileupload-1.3.1.jar:1.3.1] 
    at org.apache.commons.fileupload.util.Streams.copy(Streams.java:70) ~[commons-fileupload-1.3.1.jar:1.3.1] 
    at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:347) ~[commons-fileupload-1.3.1.jar:1.3.1] 
    ... 58 common frames omitted 

回答

0

您的/tmp目錄正在被其他進程定期清理。

一個常見的情況。

設置臨時目錄中的web應用比/tmp(又名java.io.tmpdir

See prior answer about your options on how to setup a temp directory for your webapp.

+0

感謝您的解決方案,但我認爲這個問題是與磁盤大小的其他某個地方,是滿的,因此它不能在/ tmp目錄下創建新的目錄,但我喜歡,tmp路徑應該是默認目錄以外的目錄。 – itontips