接口测试中用postman测试返回是正常的,但是使用其他人去调用就出错了,找了半天,才想起来使用了nginx,用于端口的代理转发。然后根据错误信息发现json格式的某个字段为null,结合日志中的报文:

  {"MSG":"查询成功","OPERATE_TIME":"1568170376","STATUS":"0000","state":null}

发现state对应的值为null,所以猜测是nginx对报文做了处理。

错误如下:

{"timestamp":"2019-09-11T03:04:30.036+0000","status":500,"error":"Internal Server Error","message":"Could not write JSON: Object is null; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Object is null (through reference chain: net.sf.json.JSONObject[\"state\"]->net.sf.json.JSONNull[\"empty\"])","path":"..."}

分析可能的原因:

   我在代码中返回的json对象是net.sf.json.JSONObject,而nginx中处理报文时fastjson,处理过程中将value为null取消了,导致json结构发生错误。

  (ps: 这是我猜测的结果,由于目前对nginx还不熟悉,以后再添加具体分析)

解决办法:

  将value为null改成为“” (空字符串)就可以了。

记一次接口调试错误: {"timestamp":"2019-09-11T03:04:30.036+0000","status":500,"error":"Internal Server Error","message":"Could not write JSON: Object is null; nested exception is com.fasterxml.jackson的更多相关文章

  1. HttpMessageNotWritableException: Could not write JSON: Infinite recursion (StackOverflowError); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Infinite

    org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Infinite r ...

  2. JSON parse error: Can not deserialize instance of java.lang.String out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of j

    异常信息如下: JSON parse error: Can not deserialize instance of java.lang.String out of START_OBJECT token ...

  3. JSON parse error: Cannot deserialize instance of `int` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc

    代码程序: @PostMapping("selectById") @ResponseBody public Result selectById(@RequestBody int i ...

  4. VS2012 调试Web项目 遭遇 HTTP 错误 500.23 - Internal Server Error

    原文:VS2012 调试Web项目 遭遇 HTTP 错误 500.23 - Internal Server Error 在使用vs2012 调试Web站点时 报错 500.23,详细如图 此错误是因为 ...

  5. 16. nested exception is com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "auditUnitName"

    org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver:handleHttpMessageNotRead ...

  6. HTTP 错误 500.19 – Internal Server Error web.config 文件的 system.webServer/httpErrors 节中不允许绝对物理路径“C:\inetpub\custerr”[转]

    给ASP或者ASP.NET等需要配置IIS服务器的过程中,很可能会遇到以下两种错误.尤其是用Win7系统的,配置IIS7.0版本比用XP系统配置IIS5.1版本而言要复杂复杂一些.当同时需要配置ASP ...

  7. IIS错误解决办法(HTTP Error 500.19 - Internal Server Error)

    window10 切换登陆用户,VS2015的IIS Express 调试代码报HTTP Error 500.19 - Internal Server Error 错误,无法读取配置文件解决办法. I ...

  8. HTTP 错误 500.21 - Internal Server Error 解决方案

    不久前重新安装了Windows7,在安装了VS2010 开发平台之后,将网站发布到IIS,访问发生如下错误: HTTP 错误 500.21 - Internal Server Error处理程序“Ni ...

  9. HTTP 错误 500.21 - Internal Server Error 处理程序“PageHandlerFactory-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler”

    HTTP 错误 500.21 - Internal Server Error 处理程序“PageHandlerFactory-Integrated”在其模块列表中有一个错误模块“ManagedPipe ...

随机推荐

  1. JavaScript 语句解析

    在 HTML 中,JavaScript 语句是由 web 浏览器“执行”的“指令”. 实例 var x, y, z; // 语句 1 x = 22; // 语句 2 y = 11; // 语句 3 z ...

  2. URL跳转绕过姿势

    POC "@" http://www.target.com/redirecturl=http://whitelist.com@evil.com "\" http ...

  3. 团队项目之Scrum2

    小组:BLACK PANDA 时间:2019.11.17 每天举行站立式会议 提供当天站立式会议照片一张 2 昨天已完成的工作 2 确定用户登录与注册和编辑页面的接口 前端方面:详细确定页面的功能,并 ...

  4. rsync nfs web01总结

    目录 rsync nfs web01总结 要求 部署rsync服务端(172.16.1.41) 部署rsync客户端(172.16.1.31.172.16.1.7) 部署web代码 NFS服务端部署 ...

  5. git集成idea

    1.Git Gui的使用 2.Ssh key 介绍及使用 3.Idea配置使用并使用git Git Gui的使用 Ssh key 介绍及使用 Ssh key介绍 我理解的就是每台电脑上会产生出一个ss ...

  6. acwing 528. 奶酪 解题记录

    习题地址 https://www.acwing.com/problem/content/description/530/ 现有一块大奶酪,它的高度为h,它的长度和宽度我们可以认为是无限大的,奶酪中间有 ...

  7. 2019-2020-1 20199305《Linux内核原理与分析》第六周作业

    系统调用的三层机制(下) (一)给MenuOS增加命令 (1)打开虚拟机,首先用rm -rf menu指令删除当前的menu目录,然后用git clone重新克隆一个新版本的menu,进入menu,运 ...

  8. 使用canal增量同步mysql数据库信息到ElasticSearch

    本文介绍如何使用canal增量同步mysql数据库信息到ElasticSearch.(注意:是增量!!!) 1.简介 1.1 canal介绍 Canal是一个基于MySQL二进制日志的高性能数据同步系 ...

  9. Spring 中AOP及前后置增强案例

    1.AOP面向切面编程 面向切面编程的本质:面向切面编程,指扩展功能不修改源代码,将功能代码从业务逻辑代码中分离出来.  1主要功能:日志记录,性能统计,安全控制,事务处理,异常处理等等.  2主要意 ...

  10. IT兄弟连 Java语法教程 赋值运算符

    从本书之前的内容中就一直在使用赋值运算符.现在是正式介绍赋值运算符的时候了.赋值运算符是单个等号”=“.在Java中,赋值运算符的工作方式与所有其它计算机语言相同.它的一般形式如下: var = ex ...