临时上传位置[/tmp/tomcat.4296537502689403143.5000/work/Tomcat/localhost/ROOT]无效 [英] The temporary upload location [/tmp/tomcat.4296537502689403143.5000/work/Tomcat/localhost/ROOT] is not valid
本文介绍了临时上传位置[/tmp/tomcat.4296537502689403143.5000/work/Tomcat/localhost/ROOT]无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Spring Boot 1.5.13版本.
I am using Spring Boot 1.5.13 version.
我收到如下异常消息.
Could not parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location [/tmp/tomcat.4296537502689403143.5000/work/Tomcat/localhost/ROOT] is not valid
我在Spring Github Issues中建立了这个问题. https://github.com/spring-projects/spring-boot/issues/9616
I founded out this issue in Spring Github Issues. https://github.com/spring-projects/spring-boot/issues/9616
但是我仍然对此有疑问.
But I still have questions of that.
- 我没有在我的应用程序中使用文件上传功能.但是日志说无法解析多部分servlet请求"为什么会这样? (当我的应用程序使用RestTemplate(Post方法)时,我遇到了例外情况
- 为解决该异常,我重新启动了我的应用程序,但此操作无法立即生效.尽管我重新启动了我的应用程序,但它引用了不存在的tomcat目录.重启一天后,它可以正常工作.我想目录是在Spring或其他地方缓存的..?
请帮帮我!
推荐答案
- http POST方法将使用这些临时位置来存储帖子数据.
- 某些操作系统(例如centOS)会经常删除temp dir.因此,即使您设置了该位置的许可,一段时间后,该目录也会被操作系统删除.重新启动后,临时目录将有所不同.
您可以在application.yml中设置多部分位置:
You can set the multipart location in application.yml:
spring:
http:
multipart:
location: /data/upload_tmp
更新
根据Vivek Sethi的评论,上面的属性对我不起作用,但下面的属性对我不起作用.
As per comment by Vivek Sethi above property didn't work for me but the below one.
spring.servlet.multipart.location=/data/upload_tmp
这篇关于临时上传位置[/tmp/tomcat.4296537502689403143.5000/work/Tomcat/localhost/ROOT]无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文