Redis缓存查询时报字段无法识别问题-SerializationException: Could not read JSON: Unrecognized xxx

报错信息:

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.data.redis.serializer.SerializationException: Could not read JSON: Unrecognized field "houseType4Search" (class com.haoke.pojo.Item), not marked as ignorable (15 known properties: "isRented", "img", "price", "city", "sales", "info", "imgs", "rentType", "title", "recommendation", "houseType", "id", "recoSort", "buytime", "link"])
at [Source: (byte[])"{"@class":"com.haoke.pojo.Item","id":"6216363d9ba8811e82099417","title":"北京老小区","sales":300,"recommendation":true,"recoSort":9,"city":"北京","price":3000,"rentType":"整租","houseType":"60 ㎡","houseType4Search":"6/6层|2室1厅-60 ㎡","info":{"@class":"java.util.LinkedHashMap","orientation":"朝南","level":"6/6层","style":"简单装修","type":"2室1厅","years":"2000"},"imgs":["java.util.ArrayList",["http://192.168.136.130:80/group1/M00/00/00/wKiIgmITgQmAF1htAAuC467ZRns833_big"[truncated 368 bytes]; line: 1, column: 228] (through reference chain: com.haoke.pojo.Item["houseType4Search"]); nested exception is com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "houseType4Search" (class com.haoke.pojo.Item), not marked as ignorable (15 known properties: "isRented", "img", "price", "city", "sales", "info", "imgs", "rentType", "title", "recommendation", "houseType", "id", "recoSort", "buytime", "link"])
at [Source: (byte[])"{"@class":"com.haoke.pojo.Item","id":"6216363d9ba8811e82099417","title":"北京老小区","sales":300,"recommendation":true,"recoSort":9,"city":"北京","price":3000,"rentType":"整租","houseType":"60 ㎡","houseType4Search":"6/6层|2室1厅-60 ㎡","info":{"@class":"java.util.LinkedHashMap","orientation":"朝南","level":"6/6层","style":"简单装修","type":"2室1厅","years":"2000"},"imgs":["java.util.ArrayList",["http://192.168.136.130:80/group1/M00/00/00/wKiIgmITgQmAF1htAAuC467ZRns833_big"[truncated 368 bytes]; line: 1, column: 228] (through reference chain: com.haoke.pojo.Item["houseType4Search"])] with root cause

究其原因时pojo类中缺少对应的字段

image

只有get方法,没有实体字段

image

加上对应的实体字段就好没问题了

posted @   zzuli-ycz  阅读(1524)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示