Search code examples
javaserializationweblogic

NotSerializableException on HashMap


I've a hash map like : Map gen = HashMap<Integer, MyObj>

When I execute AccessController.doPrivileged(gen), it throws exception as follows. Can anyone help me on this.

java.security.PrivilegedActionException: java.io.NotSerializableException: java.util.HashMap
    at java.security.AccessController.doPrivileged(Native Method)...

This code is getting executed in Weblogic environment.


Solution

  • Your key is Integer which is Serializable by default. What is inside MyObj? I mean are there any objects inside MyObj?