java.lang.invode.SerializedLambda’ culd not be instantiated
架构:dubbo + mybatisPlus
事情是这样的:
有个关注功能
在关注之后需要异步去添加关注数

@JmsListener(destination = ActiveMqConstant.ADD_FOLLOW)
    public void asynchronousAddFabulous(Follow follow) {
            Organization organization = organizationService.getOrganizationByCode(follow.getFollowCode());
            organization.setFollowCount(organization.getFollowCount() + 1);
            UpdateWrapper<Organization> wrapper = new UpdateWrapper<>();
            wrapper.eq("code", organization.getCode());
            //	 这里使用的mybatisPlus
            organizationService.update(organization, wrapper);
     }

这个时候 因为OrganizationService 跟 当前不在同一个服务,需要将wrapper 序列化 转至OrganizationService 这个服务
出现这个错误:
在这里插入图片描述
通过查询得知:wrapper不支持也不推荐进行dubbo传递
所以这个时候,我们只需要将:

	UpdateWrapper<Organization> wrapper = new UpdateWrapper<>();
    wrapper.eq("code", organization.getCode());
     //	 这里使用的mybatisPlus
    organizationService.update(organization, wrapper);

这块修改一下:

    organizationService.modifyOrganizationByCode(organization);

将这个修改操作交给组织模块去完成,在这里只通过服务调用组织模块,这样就不会将Wrapper 进行传递
问题解决!!!

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐