异常小记 - (反序列化异常)
一、异常LOG
feign.codec.DecodeException: Error while extracting response for type [java.util.List<java.lang.Strin
g>] and content type [application/json;charset=UTF-8]; nested exception is org.springframework.http.
converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize in
stance of `java.util.ArrayList` out of START_OBJECT token; nested exception is com.fasterxml.jackson.
databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.
ArrayList` out of START_OBJECT token
at [Source: (PushbackInputStream); line: 1, column: 1]
at feign.SynchronousMethodHandler.decode(SynchronousMethodHandler.java:174)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:134)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:77)
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:102)
at com.sun.proxy.$Proxy277.getOpenIdByEasemobAccounts(Unknown Source)
at com.fqkj.webhouse.service.wx.impl.WxMessageServiceImpl.sendWxInfo(WxMessageServiceImpl.java
at com.fqkj.webhouse.controller.WxMessageApiImpl.sendWxInfo(WxMessageApiImpl.java:84)
at sun.reflect.GeneratedMethodAccessor1012.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMeth
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHan
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeA
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHa
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleIn
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHand
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.jav
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.jav
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.fqkj.comm.service.userauth.TransmitUserInfoFilter.doFilter(TransmitUserInfoFilter.java:
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.jav
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.jav
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTra
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.jav
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.cloud.sleuth.instrument.web.ExceptionLoggingFilter.doFilter(ExceptionLo
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.jav
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at brave.servlet.TracingFilter.doFilter(TracingFilter.java:86)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.jav
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMet
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMet
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(W
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.jav
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFi
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.jav
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:800)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1471)
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)
Caused by: org.springframework.web.client.RestClientException: Error while extracting response for
type [java.util.List<java.lang.String>] and content type [application/json;charset=UTF-8]; nested
exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON
parse error: Cannot deserialize instance of `java.util.ArrayList` out of START_OBJECT token; nested
exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot d
eserialize instance of `java.util.ArrayList` out of START_OBJECT token
at [Source: (PushbackInputStream); line: 1, column: 1]
at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConvert
at org.springframework.cloud.openfeign.support.SpringDecoder.decode(SpringDecoder.java:60)
at org.springframework.cloud.openfeign.support.ResponseEntityDecoder.decode(ResponseEntityDeco
at feign.optionals.OptionalDecoder.decode(OptionalDecoder.java:36)
at feign.SynchronousMethodHandler.decode(SynchronousMethodHandler.java:170)
... 69 common frames omitted
Caused by: org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cann
ot deserialize instance of `java.util.ArrayList` out of START_OBJECT token; nested exception is com.fasterxml
.jackson.databind.exc.MismatchedInputException: Cannot deserialize instan
ce of `java.util.ArrayList` out of START_OBJECT token
at [Source: (PushbackInputStream); line: 1, column: 1]
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(A
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.read(AbstractJ
at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConvert
... 73 common frames omitted
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance o
at [Source: (PushbackInputStream); line: 1, column: 1]
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.j
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationCo
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(Deserialization
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(Deserialization
at com.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.handleNonArray(String
at com.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.deserialize(StringCol
at com.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.deserialize(StringCol
at com.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.deserialize(StringCol
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3084)
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(A
... 75 common frames omitted
二、原因
- 前端会将环信id的集合发给我,但是前端没有进行判断去除错误的数据,导致我接受到的数据存在长度为0的id
- 自己后端也没有过滤处理,导致sql查询时出现异常
三、结论
真特么粗心大意,以后再出现这种事情给自己俩耳刮子
,就是这么狠(人不狠站不稳!!!)