背景:我们在login-service的微服务中进行登录校验,生成token做为Redis的key,把RmUserVo缓存到Redis中(没有使用JSON格式,直接使用对象),在其他的业务微服务中使用token去Redis中获取数据,转成RmUserVo类,报如下错误.
: Could not read JSON: Could not resolve type id '' into a subtype of [simple type, class ]: no such class found
at [Source: [B@79ed6999; line: 1, column: 32]; nested exception is : Could not resolve type id '' into a subtype of [simple type, class ]: no such class found at [Source: [B@79ed6999; line: 1, column: 32] at .(:73)
报错原因:业务微服务中的RmUserVo路径和login-service的微服务中的RmUserVo路径(全限定名)不同,在Redis取的数据转换类型的时候,因为接受实体类的路径不同,类型转换失败.
解决办法,业务微服务RmUserVo路径调整为和login-service的微服务一致即可.