Hi all,
I'm developing a simple RMI chat server.
Im getting following exception when i execute Client.
Server works well.
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:273)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:251)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:160)
at ServrImplementation_Stub.joinChatRoom(Unknown Source)
at ClientImplementation.<init>(ClientImplementation.java:28)
at ClientImplementation.main(ClientImplementation.java:79)
this is my client implementation
public ClientImplementation(String name) throws RemoteException
{
String arg = "rmi://localhost:2828/chatfun";
myName=name;
// myGui=gui;
try{
csi=(chatServerInterface)Naming.lookup(arg);
csi.joinChatRoom(name,(chatClientInterface)this);//this is the line which the exception shows
this.chatStart();
}catch(Exception ex)
{
//JOptionPane.showMessageDialog(null, "Failed\n"+ex.printStackTrace());
//System.out.println("Failed to bind\n"+ex.printStackTrace());
ex.printStackTrace();
System.exit(0);
}
}
this is my server interface
public interface chatServerInterface extends Remote{
public void joinChatRoom(String clientName,chatClientInterface c) throws RemoteException ;
public void leaveChatRoom(String clientName) throws RemoteException;
public void sendToAll(String msg,String name) throws RemoteException;
public java.util.Iterator getOnlineClients() throws RemoteException;
}
PLZZZZZZZZZZz....help me i cannot find the mistake i made.