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

java.lang.IllegalArgumentException:参数类型不匹配$Proxy0.joinNetwork(未知源),java,rmi,Java,Rmi,这是我的密码: public class PeerNode extends UnicastRemoteObject implements PeerInterface { private PeerInterface joint; private List<PeerNode> neighbours; public PeerNode(String s, int idnumber) throws IOException { PeerNode.setN

这是我的密码:

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);
    }
我正在尝试通过对象远程对等。。。在这条线上

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。。。但它不起作用。 有人能帮我吗? 这是接收对象的类

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

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

void joinNetwork(PeerInterface peer) throws RemoteException;

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

如果将方法更改为public void joinNetwork(PeerInterface p)抛出RemoteException怎么办?我收到了相同的错误。谢谢你的回答。。。他们帮了我,我把它修好了。我已经试过了,但直到我改变了这个:私人名单邻居;
void joinNetwork(PeerInterface peer) throws RemoteException;