I use spring with another frameworks nad I'm new in serialization.
What the problem:
I need to serialize MyClass object that contains the org.eclipse.jetty.websocket.api.Session session (which is non-serializable).
class MyClass {
private org.eclipse.jetty.websocket.api.Session session; //NON-Serializable!
private void writeObject(java.io.ObjectOutputStream out) throws IOException{
out.writeObject(session);
}
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
session = (org.eclipse.jetty.websocket.api.Session) in.readObject();
}
}
What the question:
I've read from here that it is possible to serialize object with non-serializable fields. But, org.eclipse.jetty.websocket.api.Session has not-trivial class hierarchy.
But when I try to doing so, it throw java.io.NotSerializableException: org.eclipse.jetty.websocket.common.WebSocketSession