java.lang.IllegalArgumentException:参数类型不匹配 $Proxy0.joinNetwork(未知来源)

java.lang.IllegalArgumentException: argument type mismatch $Proxy0.joinNetwork(Unknown Source)

这是我的代码:

public class PeerNode extends UnicastRemoteObject implements PeerInterface {

    private PeerInterface joint;
    private List<PeerNode> neighbours;
    public PeerNode(String s, int idnumber) throws IOException {
        PeerNode.setNome(s);
        PeerNode.setKey(idnumber);
        this.neighbours = new ArrayList<>();
        System.out.println("Peer node initialized");
        System.out.println(this);
    }

    public void contactExistingNode(String node) throws Exception, RemoteException, NotBoundException {
        System.out.println("I know the peer "+ node);
        System.out.println("I try to join automatically the network");
        joint = (PeerInterface) registry.lookup(node);
        joint.joinNetwork(this);
    }

这是界面:

public interface PeerInterface extends Remote {

    public void joinNetwork(PeerNode p) throws RemoteException;

}

我正在尝试传递对象远程对等...并在这一行

joint.joinNetwork(this);

我有这个错误:

Exception in thread "main" java.lang.IllegalArgumentException: argument type mismatch
...
at com.sun.proxy.$Proxy0.joinNetwork(Unknown Source)
at com.server.PeerNode.contactExistingNode(PeerNode.java:41)
at com.server.Main.main(Main.java:51)

我已经将其转换为 PeerInterface、PeerNode...但它不起作用。 有人可以帮助我吗? 这是收到对象的class

public void joinNetwork(PeerNode p) throws RemoteException {
    neighbours.add(p);
}

客户端没有远程对象的实例。它有一个远程接口的实例。远程方法的签名应该是

void joinNetwork(PeerInterface peer) throws RemoteException;

修复您的远程接口、远程对象和客户端;重新编译;重新部署;并重新测试。