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


here code:

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 peer "+ node);         system.out.println("i try join automatically network");         joint = (peerinterface) registry.lookup(node);         joint.joinnetwork(this);     } 

and interface:

public interface peerinterface extends remote {      public void joinnetwork(peernode p) throws remoteexception;  } 

i'm trying pass object remote peer... , @ line

joint.joinnetwork(this); 

i have error:

exception in thread "main" java.lang.illegalargumentexception: argument type mismatch ... @ com.sun.proxy.$proxy0.joinnetwork(unknown source) @ com.server.peernode.contactexistingnode(peernode.java:41) @ com.server.main.main(main.java:51) 

i casted peerinterface, peernode... doesn't work. can me? class receive object

public void joinnetwork(peernode p) throws remoteexception {     neighbours.add(p); } 

the client doesn't have instance of remote object. has instance of remote interface. signature of remote method should be

void joinnetwork(peerinterface peer) throws remoteexception; 

fix remote interface, remote object, , client; region; redeploy; , retest.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -