Does a RemoteObject method's return object has to be a serializable? For example, A is a remote object and has the function:
SomeObject getMyObject() throws java.rmi.RemoteException
does SomeObject have to be serializable?
Well according to the docs it should be:
2.6 Parameter Passing in Remote Method Invocation
An argument to, or a return value from, a remote object can be any object that is serializable. This includes primitive types, remote objects, and non-remote objects that implement the java.io.Serializable interface. For more details on how to make classes serializable, see the "Java Object Serialization Specification." Classes, for parameters or return values, that are not available locally are downloaded dynamically by the RMI system. See the section on "Dynamic Class Loading" for more information on how RMI downloads parameter and return value classes when reading parameters, return values and exceptions.
http://docs.oracle.com/javase/1.5.0/docs/guide/rmi/spec/rmi-objmodel7.html
And this makes sense. The Object should transmitted from one node to the other. In order to be transmitted, it should be placed in a socket (at some point), so it should serialized.