接口测试中用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. JS 逻辑

    JS 逻辑 Boolean(逻辑)对象用于将非逻辑值转换为逻辑值(true 或者 false). Boolean 对象 您可以将 Boolean 对象理解为一个产生逻辑值的对象包装器. Boolean ...

  2. Java反射03 : 获取Class的注解、修饰符、父类、接口、字段、构造器和方法

    java.lang.Class类提供了获取类的各种信息对象的静态方法. 本文转载自:https://blog.csdn.net/hanchao5272/article/details/79363921 ...

  3. Django出错提示TemplateDoesNotExist at /

    Issue: 打开login URL的时候报错如下: Action: 在setting.py中修改DIRS,模板文件目录 TEMPLATES = [ { 'BACKEND': 'django.temp ...

  4. Memcached 基本语法 记录

    set 命令:命令将value数值存储在指定的key中: set key flags exptime bytes [noreply] value key:键值 key-value 结构中的 key,用 ...

  5. [apue] syslog 导致 accept 出错?

    前几天在看apue第16章关于socket的例子,就是一个非常典型的socket服务器,关键代码如下: void serve (int sockfd) { int ret; int clfd; int ...

  6. A Neural Influence Diffusion Model for Social Recommendation 笔记

    目录 一.摘言 二.杂记 三.问题定义和一些准备工作 四.模型真思想 五.实验部分 六.参考文献 一.摘言 之前协同过滤利用user-item交互历史很好的表示了user和item.但是由于用户行为的 ...

  7. element-ui中的hover 光标移入某一个具体的td 有hover效果

    <template> <div> <el-table :data="tableData" style="width: 100%"& ...

  8. request请求参数与http请求过程

    request请求参数

  9. 7.SourceTree 的使用

    SourceTree 是 Windows 和Mac OS X 下免费的 Git 和 Hg 客户端管理工具,同时也是Mn版本控制系统工具.支持创建.克隆.提交.push.pull 和合并等操作. 下载路 ...

  10. hebust-fengyu

    三人行必有我师焉,择其善者而从之,其不善者而改之. 入则无法家拂士,出则无敌国外患者,国恒亡,然后知生于忧患而死于安乐也. 狡兔死走狗烹,飞鸟尽良弓藏,敌国尽谋臣亡 今齐地方千里,百二十城,宫妇左右莫 ...