Spring Boot报错:尤其是在处理Ribbon这类接口调用型的负载均衡组件,常见问题
ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location [/tmp/tomcat.1222167204409692266.8781/work/Tomcat/localhost/ROOT] is not valid] with root cause
java.io.IOException: The temporary upload location [/tmp/tomcat.1222167204409692266.8781/work/Tomcat/localhost/ROOT] is not valid
at org.apache.catalina.connector.Request.parseParts(Request.java:2877)
at org.apache.catalina.connector.Request.parseParameters(Request.java:3242)
at org.apache.catalina.connector.Request.getParameter(Request.java:1136)
at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:381)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:84)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
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:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:103)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
原因有二:
- The http POST methods will use these temp location to store the post data.
- http post接口请求参数需要保存到服务器临时路径
- Some OS like centOS will delete the temp dir frequently. SO even you set that location's permission, after some time, that dir will be removed by OS. And after you reboot, the temp dir will be different.
- 常用的云服务器如centOS,定期会删除这些临时路径,且每次重启路径不同.因此,需指定临时保存路径
处理如下:
spring:
# post 接口 临时目录设置,避免被操作系统清除
http:
multipart:
location: /data/upload_tmp
Spring Boot报错 MultipartException The temporary upload...的更多相关文章
-
Spring Boot 报错记录
Spring Boot 报错记录 由于新建的项目没有配置数据库连接启动报错,可以通过取消自动数据源自动配置来解决 解决方案1: @SpringBootApplication(exclude = Dat ...
-
springboot放到linux启动报错:The temporary upload location [/tmp/tomcat.8524616412347407692.8111/work/Tomcat/localhost/ROOT/asset] is not valid
1.背景 笔者的springboot在一个非root用户环境下运行,这种环境下可以保证不被潜在的jar/开源框架漏洞提权. 比如在防火墙上把外网访问来的443端口映射到本地8443的java web端 ...
-
初学 Spring boot 报错 Whitelabel Error Page 404
按照教程,写了个最简单的 HelloWorld,尼玛报错 -->Whitelabel Error Page 404. 网上99%都是项目结构不对,说什么 Application放在父级 pack ...
-
启动Spring boot报错:nested exception is java.sql.SQLException: Field 'id' doesn't have a default value
先看具体日志: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with n ...
-
spring boot 报错 Failed to read HTTP message
2008-12-13 15:06:03,930 WARN (DefaultHandlerExceptionResolver.java:384)- Failed to read HTTP message ...
-
Spring Boot 报错:Error creating bean with name 'entityManagerFactory' defined in class path resource
spring boot 写一个web项目,在使用spring-data-jpa的时候,启动报如下错误: Error starting ApplicationContext. To display th ...
-
在系统下文件上传报错:The temporary upload location [/tmp/tomcat.xxx/work/Tomcat/localhost/ROOT] is not valid
线上的系统中长时间不访问时不能上传文件了,出现如下错误: 2019-03-11 23:37:42.741 ERROR 66505 --- [nio-8081-exec-3] o.a.c.c.C.[.[ ...
-
Spring boot 报错 Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
在实际开发中修改别人的代码,发现了这个报错,后来发现是因为pom.xml里面 只要将注释掉的部分注释掉就好了.
-
spring boot 报错 Error creating bean with name
Application 启动类 要和父目录平级
随机推荐
-
swift 的高阶函数的使用代码
//: Playground - noun: a place where people can play import UIKit var str = "Hello, playground& ...
-
hdu4747——Mex
1.题目大意:对一个序列的每一个区间求Mex,最后所有的mex相加(mex就是SG的那个),力求nlogn... 2.分析:最近开始刷线段树了,还是有很多不会啊 首先把1-1 1-2 1-- 1-n这 ...
-
EL(表达式语言)
EL(Expression Language):目的是为了简化Jsp页面的语言,使页面看起来更加简洁 基本的语法特点 以“${"开头,以”}“结束 一 与低版本的环境兼容----禁用EL ( ...
-
vim 括号自动补全
来源:http://www.cnblogs.com/huanlei/archive/2012/04/02/2430153.html 有时要重新配置vim 的,所以收藏了: inoremap ( ()& ...
-
boost高质量随机数库 zhuan
shared_ptr<int> tmp2(new int(10)) ; int * test=tmp2.get(); std::cout<<*test<<" ...
-
高性能计算linux集群常用配置
1.检查超线程 查看线程数:grep siblings /proc/cpuinfo |uniq 查看物理核心数:grep cores /proc/cpuinfo |uniq 2.检查操作系统版本 ca ...
-
@@identity与scope_identity()函数的区别
@@IDENTITY 和SCOPE_IDENTITY 返回在当前会话中的任何表内所生成的最后一个标识值. SCOPE_IDENTITY 只返回插入到当前作用域中的值: @@IDENTITY 不受限于特 ...
-
codevs2189数字三角形(%100)
题目:http://codevs.cn/problem/2189/ %100的话就加一维状态.把最优性改为可行性(存在性). #include<iostream> #include< ...
-
vCard : a file format standard for electronic business cards
http://zh.wikipedia.org/wiki/VCard vCard是电子名片的文件格式标准.它一般附加在电子邮件之后,但也可以用于其它场合(如在互联网上相互交换). vCard可包含的信 ...
-
wordpress对使用的国外主题进行本地汉化
wordpress有非常多优秀与专业的主题,当然大多数是非中文的 这些主题本身总会有些无法通过wordpress admin后台来配置的在页面上的英文输出 此时你可以去对应的代码去改掉那些输出,不过这 ...