This was my oversight, I thought the HashMap doesn't implement Serializable interface. I have fixed it.