|
| <prev next> |
Re: Help: argument type mismatch: msg#00048java.sun.rmi
When marshalling the arguments or result of a remote method invocation, J2SE RMI (JRMP) automatically replaces JRMP-exported remote objects with their corresponding remote stubs.[*] Presumably you do indeed want your client to pass a remote reference (stub) to the server, instead of passing (a copy of) the callback remote object itself. The "argument type mismatch" occurs because the stub class does not extend the class Callback, your remote object's implementation class. The stub class does implement the interface CallbackInterface, your remote interface. The solution is to change the parameter type of ServerInterface's rmtRegisterClient method to be CallbackInterface instead of Callback. -- Peter [*] java.rmi.MarshalledObject's constructor also does such replacement. > I've been trying to get a callback to work, but have never done so > before. I'm currently hungup by the following error in the > following line. I've created simplified files to try and isolate > the problem. Anyone know what causes this exception? > java.lang.IllegalArgumentException: argument type mismatch > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source) > at sun.rmi.transport.Transport$1.run(Unknown Source) > at java.security.AccessController.doPrivileged(Native Method) > at sun.rmi.transport.Transport.serviceCall(Unknown Source) > at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source) > at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown > Source) > at java.lang.Thread.run(Unknown Source) > at > sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source) > at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source) > at sun.rmi.server.UnicastRef.invoke(Unknown Source) > at Server_Stub.rmtRegisterClient(Unknown Source) > at Client.CallTheServer(Client.java:41) > at Client.run(Client.java:21) > at Client.main(Client.java:28) > public class Callback extends UnicastRemoteObject implements > CallbackInterface { > public int rmtFinalizeMove() throws RemoteException { > int l_nMyInt = 1; > return l_nMyInt; > } > > public int rmtSayHi() throws RemoteException { > int l_nSuccess = 0; > System.out.println("rmtSayHi has been called!"); > return l_nSuccess; > } > > public Callback() throws RemoteException { > } > } > public interface CallbackInterface extends Remote { > public int rmtFinalizeMove() throws RemoteException; > public int rmtSayHi() throws RemoteException; > } > import java.rmi.*; > import java.util.Vector; > > public interface ServerInterface extends Remote { > public String rmtMakeMove() throws RemoteException; > public int rmtRegisterClient( Callback p_cCallback ) throws > RemoteException; > } =========================================================================== To unsubscribe, send email to listserv@xxxxxxxxxxxx and include in the body of the message "signoff RMI-USERS". For general help, send email to listserv@xxxxxxxxxxxx and include in the body of the message "help". For a list of frequently asked RMI questions please refer to: http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html To view past RMI-USERS postings, please see: http://archives.java.sun.com/archives/rmi-users.html
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Why is java.rmi.server.SkeletonMismatchException deprecated?, Peter Jones - JavaSoft East |
|---|---|
| Previous by Thread: | Help: argument type mismatch, Steven M Payeur |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |