测试Java RMI时报告一下错误
java.rmi.MarshalException: error marshalling arguments; nested exception is:
java.io.NotSerializableException: com.server.IHelloImplat sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at java.rmi.Naming.bind(Naming.java:111)
at com.siemens.server.HelloServer.main(HelloServer.java:21)
Caused by: java.io.NotSerializableException: com.server.IHelloImpl
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
... 3 more
原因在于需要继承UnicastRemoteObject
参照:http://www.asjava.com/distributed-java/java-rmi-error-unmarshalling-arguments/