Object output stream doesn't write custom object
java, serialization
Solution
Your object must implement `Serializable`. Your "custom" abstract class must also be serializable. If you cannot change the abstract class (i.e. it's not under your control), then the following applies:
To allow subtypes of non-serializable classes to be serialized, the subtype may assume responsibility for saving and restoring the state of the supertype's public, protected, and (if accessible) package fields. The subtype may assume this responsibility only if the class it extends has an accessible no-arg constructor to initialize the class's state. It is an error to declare a class Serializable if this is not the case. The error will be detected at runtime.
Regarding your sentence:
I don't know anything about serialization
Then I suggest you go and do some research ... Start by reading:
- Discover the secrets of the Java Serialization API
- `Serializable` Javadoc
- `ObjectOutputSteam` Javadoc
Problem
I'm using socketserver to send some data via `ObjectOutputStream`. It works fine for any standard Java object, but I can't send my custom objects. I get java.io.NotSerializableException: MyObject. I don't know anything about serialization, but I did it, where Eclipse told so. Also tried remove it everywhere, nothing helps. My object is inherit from an other custom abstract class, didn't test it to other custom objects yet.