-2

I want to create an instance , put it on a container and send it.

TransferContainer container = null;
    ...
  Class aClass = container.getByteCode();
    o = aClass.newInstance();
    ....// Some code
    ...
    container.setInstance(o);
    ObjectOutputStream out = new ObjectOutputStream(_s.getOutputStream());
    out.writeObject(container);

I get this error

java.io.NotSerializableException If I don't add the the instance o in the container I can send it without any problem.

4

1 回答 1

0

此异常的原因是aClass 或aClass 的某些实例字段没有实现Serializable。

于 2014-07-11T21:19:15.617 回答