fastjson JSON.toJSONString Class java.util.HashSet does not implement the requested interface java.util.List

qc6wkl3g  于 2021-11-27  发布在  Java
关注(0)|答案(2)|浏览(317)

FastJson version 1.2.51

Object v = cacheManager.getByFst(ICacheKey.ORDER_COUPON_KEY + orderNo);

    if (Validator.isNotNull(v)) {
        try {
            return JSON.parseObject(JSON.toJSONString(v), MeCouponDTO.class);
        } catch (Exception e) {
            log.info("getMeCouponByOrderNo 解析缓存出错 orderNo:{}", orderNo);
        }
    }

Class

private static final long serialVersionUID = -1;

private Integer couponId;

private String description;

/**
 * 是否选用 0 未选用 1 已经选用
 */
private Integer selected;

/**
 * 是否被限制 0 未被限制 1 被限制
 */
private Integer limited;

/**
 * 是否可用 0 不可用 1 可用
 */
private Integer canUse;

/**
 * 满额
 */
private BigDecimal reachPrice;

/**
 * 减额
 */
private BigDecimal discountPrice;

/**
 * 还差额度可用
 */
private BigDecimal diffPrice;

@JsonFormat(pattern="yyyy.MM.dd", timezone = "GMT+8")
private Date startTime;

@JsonFormat(pattern="yyyy.MM.dd", timezone = "GMT+8")
private Date endTime;

private String name;

private Integer useStatus;

private Integer couponRecordId;

/**商品限制 1 优鲜全场 2 优鲜指定品类 3 指定商品**/
private Integer goodsLimit;

/**平台限制 1 不限 2 小程序 3 app**/
private Integer platformLimit;

/**
 * 城市限制 1:不限 2:限制城市
 */
private Integer cityLimit;

private Integer shopLimit;

private Integer leaderCommissionLimit;

private List<SpellCouponCategoryDTO> categoryList;

private List<SpellCityDTO> cityList;

/**
 * 当前选择商品金额
 */
private BigDecimal currentPrice;

private Set<String> goodsNoList = Sets.newHashSet();
  • ERROR: 2019-12-18 06:59:22.338 10.13.30.24 [com.alibaba.dubbo.rpc.filter.ExceptionFilter.java:87 ExceptionFilter::invoke()] traceid[idc01-wms-wl-00^1574994696795^7309011] traceUrl[idc01-wms-wl-00/idc01-wms-wl-00^1574994696795^7309011/1576623562135/7887691499227193640] rpcid[7887691499227193640] logid[157662356244944401] url[com.mryt.spell.order.center.service.SpellOrderOmsService.wmsDeliveryNotify] [DUBBO] Got unchecked and undeclared exception which called by 10.13.30.55. service: com.mryt.spell.order.center.service.SpellOrderOmsService, method: wmsDeliveryNotify, exception: java.lang.IncompatibleClassChangeError: Class java.util.HashSet does not implement the requested interface java.util.List, dubbo version: 2.6.0.2, current host: 10.13.30.24

java.lang.IncompatibleClassChangeError: Class java.util.HashSet does not implement the requested interface java.util.List
at com.alibaba.fastjson.serializer.ASMSerializer_5_MeCouponDTO.write(Unknown Source)
at com.alibaba.fastjson.serializer.JSONSerializer.write(JSONSerializer.java:281)
at com.alibaba.fastjson.JSON.toJSONString(JSON.java:676)
at com.alibaba.fastjson.JSON.toJSONString(JSON.java:614)
at com.alibaba.fastjson.JSON.toJSONString(JSON.java:579)
at com.mryt.spell.coupon.center.service.impl.SpellCouponServiceImpl.getMeCouponByOrderNo(SpellCouponServiceImpl.java:867)
at com.mryt.spell.coupon.center.service.impl.SpellCouponServiceImpl$$FastClassBySpringCGLIB$$82525d64.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:84)
at com.mryt.cat.service.CatAopService.aroundMethod(CatAopService.java:33)
at sun.reflect.GeneratedMethodAccessor191.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671)
at com.mryt.spell.coupon.center.service.impl.SpellCouponServiceImpl$$EnhancerBySpringCGLIB$$7751bf1f.getMeCouponByOrderNo()
at com.alibaba.dubbo.common.bytecode.Wrapper10.invokeMethod(Wrapper10.java)
at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:45)
at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:71)
at com.alibaba.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:48)
at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:52)
at com.missfresh.as.log.filter.NoticeFilterDubbo.invoke(NoticeFilterDubbo.java:59)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.missfresh.as.log.monitor.DubboMonitorLogProviderFilter.invoke(DubboMonitorLogProviderFilter.java:37)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:64)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:41)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:77)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.mryt.cat.dubbo.catmonitor.CatTransaction.invoke(CatTransaction.java:58)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:71)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:131)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:37)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:37)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:98)
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:96)
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:168)
at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:50)
at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:79)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)

wkyowqbh

wkyowqbh1#

@qifanyang 帮忙看一下

ruarlubt

ruarlubt2#

最新的代码已经修复了hashset的反序列化问题。
请等待新版本发布,或者自己按此修改:
#2936

相关问题