Remote object parameters transferred between client and server using Java Serialization. In this case, both client and server must implement the Serializable interface, right? But when I read some of RMI code, like the code in "Getting Started Using RMI" on http://java.sun.com/j2se/1.3/docs/guide/rmi/getstart.doc.html, there does not implement the Serializable interface at all, so how remote object parameters transferred between client and server in those examples?
Hi, The client and the server need not implement the Serializable interface. The following are requirements for RMI: 1) Server class implements Remote. 2) Classes that are passed as parameters and return types need to be implementing Serializable. All the java.lang classes like String, Integer etc already implement Serializable. Thus, if you are using user defined classes, that class should implement the Ser... interface. Hope this helps. Ashwin.
Joined: Mar 06, 2001
Thank you for your answer, Ashwin. What if the passed parameters and return types are objects created by programmers, how to implement Serializable?
Joined: Jul 17, 2000
In that case, the class should implement Serializable like
Ashwin. [This message has been edited by Ashwin Desai (edited March 27, 2001).]