json异常之JsonMappingException

2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO] org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Can not deserialize instance of java.util.LinkedHashMap out of START_ARRAY token
 at [Source: java.io.PushbackInputStream@4a03efbe; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.LinkedHashMap out of START_ARRAY token
 at [Source: java.io.PushbackInputStream@4a03efbe; line: 1, column: 1]
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:224)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.read(AbstractJackson2HttpMessageConverter.java:208)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:197)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:147)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:125)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:78)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:162)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:129)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:871)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at java.lang.Thread.run(Unknown Source)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO] Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.LinkedHashMap out of START_ARRAY token
 at [Source: java.io.PushbackInputStream@4a03efbe; line: 1, column: 1]
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:857)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:853)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at com.fasterxml.jackson.databind.deser.std.StdDeserializer._deserializeFromEmpty(StdDeserializer.java:875)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:337)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:26)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3736)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2810)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:221)
 2017-11-15 16:43:06[com.dianju.trustedSign.core.modules.models.SystemOutPrint]-[INFO]  ... 54 more

上面的错误就是json数据转换失败,转换失败的原因就是,我的当前项目就是就是使用的springboot

@SuppressWarnings({ "rawtypes"})
    @UnLoginDJ
    @UnOperationDJ
    @RequestMapping(path = "/saveYanObjectList", method = RequestMethod.POST, consumes = "application/json")
    public DJResponseEntity saveYanObjectList(@RequestBody List lili){

上面的这个地方,使用的springMVC注解开发中,自动转换前台传入的json数据,我这个方法是把前台的转换为list集合才对,可是我写了这个错误代码

@SuppressWarnings({ "rawtypes"})
    @UnLoginDJ
    @UnOperationDJ
    @RequestMapping(path = "/saveYanObjectList", method = RequestMethod.POST, consumes = "application/json")
    public DJResponseEntity saveYanObjectList(@RequestBody Map mm){

我的这个地方写错了,写成了上面的这个代码,结果前台json传入的list,后台无法转换成map集合,所以,才会报这个警,因为数据类型转换错误。

你可能感兴趣的:(spring-boot,jpa,spring)