存在未处理异常:[{timestamp=Thu Apr 19 19:33:20 CST 2018, status=500, error=Internal Server Error, exception=org.springframework.http.converter.HttpMessageNotWritableException, message=Could not write content: (was java.lang.NullPointerException) (through reference chain: com.berchina.platform.web.Response["data"]->com.berchina.platform.api.Page["content"]->java.util.ArrayList[0]->com.berchina.unified.hotinfo.api.dto.HotInformationDto["finalStatusName"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: com.berchina.platform.web.Response["data"]->com.berchina.platform.api.Page["content"]->java.util.ArrayList[0]->com.berchina.unified.hotinfo.api.dto.HotInformationDto["finalStatusName"]), path=/manager/hotinfo/hotInfos}]
出现问题要冷静处理,第一次遇到这个问题,心很慌,仔细查看下日志,用Could not write content日志全局查找,快速定位在哪里
org/springframework/spring-web/4.3.6.RELEASE/spring-web-4.3.6.RELEASE.jar!/org/springframework/http/converter/json/AbstractJackson2HttpMessageConverter.class
报错日子输出已经用红色标注,打断点才发现执行这个句objectWriter.writeValue(generator, value);报错,但是我又不知道报错原因,我就把我执行业务查询代码用fastjson进行转换,看下原因json转化失败
加入fastjson报一下错误
最后终于找到写的代码报空指针原因,继续码代码。。。。。。。
网友评论