Well, of course you can't serialize a non-serializable object. What you can do, though, is make the non-serializable members transient, implement the writeObject() and readObject() methods in your class, and use those methods to save some data that lets you reconstruct the non-serializable object later. The writeObject() method looks like
Where "computeSomethingFrom()" is an imaginary method that returns the information you'd need to reinitialize myTransientField.
Then readObject looks like
where again, "recreateTransientField()" is an imaginary method which reads the data that you wrote in "writeObject()", and returns an instance of the non-serizliable class.
The problem is face is the following. I have a client code that calls a server code. The server code fetches data and passes it on to the client code.
While the data being fetched on the server side is correct, the client receives the object being passed on to it as null. However, when i try passing a String object from the server to the client - i get the value properly.
The object being passed here is a List that in turn contains a Map (non-serializable object). It is the map object that contains the value. While the server code, populates this Map object correctly and passes it on to the client, at the client side, i find this Map object to be null.