更改了一下实体类,往实体中添加一个字段之后,接口调用出错了,控制台打印的错误信息,而且也挺奇怪的,这里只是显示了一个warning而不是error

2017-12-27 11:16:34.499  WARN 8640 --- [io-8099-exec-10] .w.s.m.s.DefaultHandlerExceptionResolver : Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Problem deserializing 'setterless' property 'foreignJoinFields': get method returned null; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Problem deserializing 'setterless' property 'foreignJoinFields': get method returned nullat [Source: java.io.PushbackInputStream@4dba74ee; line: 1, column: 927] (through reference chain: com.hyk.controller.parameter.RequestParameter["fields"]->java.util.ArrayList[0]->com.hyk.jdbc.Field["foreignJoinFields"]

我的实体类Field中有一个foreignJoinFields字段,是一个List,,代码如下:

public class Field {// 省略其他字段和getter、setter方法private List<Field> foreignJoinFields;public List<Field> getForeignJoinFields() {return foreignJoinFields;}public void setForiegnJoinFields(List<Field> foriegnJoinFields) {this.foreignJoinFields = foriegnJoinFields;}
}

看到出现这样的错误我也首先想到是方法的问题,反序列化为模型肯定是和getter/setter方法有关,但是貌似看起来都没有什么问题,后来仔细挨个对比,发现get中的foreign到了set方法中写成了foriegn,而且set方法中的参数也写错了,导致了前端发送请求反序列化时出现错误。更改之后:

public class Field {// 省略其他字段和getter、setter方法private List<Field> foreignJoinFields;public List<Field> getForeignJoinFields() {return foreignJoinFields;}public void setForeignJoinFields(List<Field> foreignJoinFields) {this.foreignJoinFields = foreignJoinFields;}
}

所以如果遇到这个问题,检查一下getter和setter方法吧。

JsonMappingException: Problem deserializing 'setterless' property '': get method returned null相关推荐

  1. Django REST framework (DRF) 不能用property或method排序

    因为在定义一个model的字段时,将值定义为类似下面的 code = models.CharField(choices=(("REGISTER", "注册"), ...

  2. Vue项目报错记录解决Property or method “item“ is not defined on the instance

    这里要实现显示一个Tabbar栏的效果,其中一行代码v-for="item in titles" 数据传输过去了,但没有展示, 报错信息 Property or method &q ...

  3. Property or method xxxx is not defined on the instance but referenced during render.

    [Vue warn]: Property or method "getdata" is not defined on the instance but referenced dur ...

  4. VUE 解决:Property or method “deleteFun“ is not defined on the instance but referenced during render.

    前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 1. 一个点击事件报错: Property or method "deleteFun&qu ...

  5. Property or method “id“ is not defined on the instance but referenced during render.Make sure ......

    Vue报错: Property or method "id" is not defined on the instance but referenced during render ...

  6. Javascript 对象不支持此属性或方法,Object doesn’t support this property or method

    中文 Microsoft 对VBscript出现这种错误的解释 Visual Basic 参考:错误消息. 对象不支持此属性或方法(Visual Basic). 为此自动化对象指定的方法或属性不存在 ...

  7. IE11 error object doesn't support property or method 'fill'

    IE 中报 object doesn't support property or method 'fill' 错误,但Chrome,Firefox正常. 这是由于IE 11本身JS支持问题导致,需要添 ...

  8. ie11 Object doesn't support property or method 'attachEvent'

    欢迎访问我的个人博客:http://www.xiaolongwu.cn 前言 大概的情景是这样的,jquery版本为1.10.1版本:浏览器为ie11:报错info为–Object doesn't s ...

  9. angular在IE下报object doesn't support property or method matches问题,以及router-outlet切换时不删除原组件而是添加一个新组件

    angular在IE下有时会报object doesn't support property or method matches问题 同时,在router-outlet切换时,不删除原组件而是添加一个 ...

  10. [Vue warn]: Property or method “throttle“ is not defined on the instance but referenced during rende

    在开发的过程中,用到了节流,引入公共的节流,初始调用如下(报错了-). template中: <button class="btn" @click="throttl ...

最新文章

  1. jsf如何通过按钮切换在同一个页面上的非公共部分显示不同的内容
  2. 用UIpickView实现省市的联动
  3. Python学习笔记之文件
  4. Linux下批量替换文件内容和文件名(转)
  5. 微信公众平台消息接口开发之校验签名与消息响应合并
  6. 【辛烷值预测】基于matlab RBF神经网络辛烷值预测【含Matlab源码 177期】
  7. 在O(1)时间复杂度删除链表节点(372)
  8. wps转html乱码,wps转换成word后乱码
  9. 基于Android Studio+Android SDK的手机通讯录管理软件设计
  10. u8g2库中文以及图片的显示入门
  11. EPP-域名映射(RFC5731翻译)
  12. Image Processing in the Spatial Domain 空间域图像处理
  13. 影响蜘蛛抓取的因素有哪些?
  14. Neural Voice Puppetry阅读笔记
  15. C#零基础运动控制教程--运动控制卡低速高速运动实验
  16. 关于多线程中的面试题
  17. 为什么别人总是把你往“坏处想”?浅谈如何更好地与项目团队中的“网友”更好地交流
  18. 66万新购奔驰漏油,车主欲暂停还贷,奔驰金融:贷款必须还!
  19. Design and Testbed Experiments of Public Blockchain-Based Security Framework for IoT-Enabled Dro
  20. MPLS 虚拟专用网络技术原理与配置

热门文章

  1. 家庭局域网_玩转Windows 10家庭组,轻松共享局域网资源,人人都可以做到
  2. 未来软件开发的发展趋势
  3. My Sixth-Third Page - 爬楼梯 - By Nicolas
  4. windows服务启动程序_在Windows上快速启动程序的5种方法
  5. ubuntu 20.04 修改文件夹默认图标
  6. 苹果企业开发账号申请三步走
  7. 闪电Android视频转换器,闪电手机视频格式转换器
  8. windows操作系统未关闭默认共享
  9. angular使用高德地图
  10. 移动架构师第一站UML建模