图片文件上传 异常处理

点击图片上传时出现以下报错:

redis.clients.jedis.exceptions.JedisException: Could not get a resource from the pool

严重: Servlet.service() for servlet [springmvc] in context with path [] threw exception [Request processing failed; nested exception is redis.clients.jedis.exceptions.JedisException:

Could not get a resource from the pool] with root cause
java.util.NoSuchElementException: Unable to validate object

https://blog.youkuaiyun.com/only1994/article/details/52785306

注释了所有的bind 127.0.0.1 和改了protected-mode为no  导致redis启动不了

 

Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused: connect

redis服务无法启动   https://blog.youkuaiyun.com/maxsky/article/details/79775118

解决方法 把这个注释打开了

 

上传成功运行log:

15:51:03,270 DEBUG ClientCnxn:742 - Got ping response for sessionid: 0x17a13be00bc0001 after 0ms
15:51:11,565 DEBUG DispatcherServlet:891 - DispatcherServlet with name 'springmvc' processing POST request for [/xxx/upload.do]
15:51:11,567 DEBUG CommonsMultipartResolver:285 - Found multipart file [imgFile] of size 21851 bytes with original filename [2.jpg], stored at [D:\Users\xxx\target\tomcat\work\Tomcat\localhost\_\upload_19a4584d_c0c3_41be_bd15_78b58fce52c6_00000002.tmp]
15:51:11,567 DEBUG RequestMappingHandlerMapping:312 - Looking up handler method for path /xxx/upload.do
15:51:11,568 DEBUG RequestMappingHandlerMapping:319 - Returning handler method [public com.itheima.entity.Result com.xxx.controller.xxxController.upload(org.springframework.web.multipart.MultipartFile)]
15:51:11,568 DEBUG DefaultListableBeanFactory:254 - Returning cached instance of singleton bean 'xxxController'
15:51:11,568 DEBUG DefaultCorsProcessor:77 - Skip CORS processing: request is from same origin
org.springframework.web.multipart.commons.CommonsMultipartFile@6b3e0da
049d955d-719b-44fe-98c8-461e0657b40e2.jpg
Fr7-15gtm-UM29Mp_l0ue8Kq2M9P
15:51:11,669 DEBUG RequestResponseBodyMethodProcessor:277 - Written [com.xxx.entity.Result@c4b8baa] as "application/json" using [com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter@6844e3e7]
15:51:11,670 DEBUG DispatcherServlet:1076 - Null ModelAndView returned to DispatcherServlet with name 'springmvc': assuming HandlerAdapter completed request handling
15:51:11,670 DEBUG CommonsMultipartResolver:322 - Cleaning up multipart file [imgFile] with original filename [2.jpg], stored at [D:\Users\xxx\target\tomcat\work\Tomcat\localhost\_\upload_19a4584d_c0c3_41be_bd15_78b58fce52c6_00000002.tmp]
15:51:11,670 DEBUG DispatcherServlet:1000 - Successfully completed request
15:51:13,271 DEBUG ClientCnxn:742 - Got ping response for sessionid: 0x17a13be00bc0001 after 0ms
15:51:23,273 DEBUG ClientCnxn:742 - Got ping response for sessionid: 0x17a13be00bc0001 after 1ms
15:51:33,273 DEBUG ClientCnxn:742 - Got ping response for sessionid: 0x17a13be00bc0001 after 0ms
15:51:43,273 DEBUG ClientCnxn:742 - Got ping response for sessionid: 0x17a13be00bc0001 after 0ms
15:51:53,273 DEBUG ClientCnxn:742 - Got ping response for sessionid: 0x17a13be00bc0001 after 0ms
15:52:03,273 DEBUG ClientCnxn:742 - Got ping response for sessionid: 0x17a13be00bc0001 after 0ms
15:52:13,144 DEBUG HeartBeatTask:64 -  [DUBBO] Send heartbeat to remote channel /192.168.150.154:20887, cause: The channel has no data-transmission exceeds a heartbeat period: 60000ms, dubbo version: 2.6.0, current host: 192.168.150.154
15:52:13,145 DEBUG HeartbeatHandler:80 -  [DUBBO] Receive heartbeat response in thread New I/O client worker #1-1, dubbo version: 2.6.0, current host: 192.168.150.154
15:52:13,275 DEBUG ClientCnxn:742 - Got ping response for sessionid: 0x17a13be00bc0001 after 0ms
15:52:23,276 DEBUG ClientCnxn:742 - Got ping response for sessionid: 0x17a13be00bc0001 after 0ms


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值