报错类似这样的是因为你相应的类没有序列化,只需要在相关类后继承序列化接口即可。 public class R<T> implements Serializable { } implements Serializable