Netty Rpc - java.lang.ClassNotFoundException

RPC 的声明如下:

...

@Route(defaultThreadId = ThreadId.ACTOR, nodeType = NodeType.GAME_SERVER)
public interface ActorRpc {
    @Rpc
    void addReward(List<Long> uidList, List<Reward> rewards);

    @Rpc
    void resetResource(List<Long> uidList, int resourceId, long value);
}

调用的时候:

 ActorRpc proxyRandom = litchi.rpc().getProxyRandom(ActorRpc.class);
        proxyRandom.addReward(uidList, new ArrayList<Reward>(){{
            add(reward);
        }});

参数的类型和声明有差异了,导致找不到方法,修改为:

List<Reward> list = new ArrayList<>();
list.add(reward);

ActorRpc proxyRandom = litchi.rpc().getProxyRandom(ActorRpc.class);
proxyRandom.addReward(uidList, list);
posted @ 2020-05-05 21:42  GoodByeZ  阅读(218)  评论(0编辑  收藏  举报