I have a serialization problem and am unable to find the cause. It's an Android app in Eclipse that's giving me a very unhelpful stack trace like this:
09-01 00:06:24.414: W/System.err(9961): java.io.NotSerializableException: com.myprogram.main.Entity$1
09-01 00:06:24.414: W/System.err(9961): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1344)
09-01 00:06:24.414: W/System.err(9961): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1651)
09-01 00:06:24.414: W/System.err(9961): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1497)
09-01 00:06:24.414: W/System.err(9961): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1461)
09-01 00:06:24.415: W/System.err(9961): at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:959)
09-01 00:06:24.415: W/System.err(9961): at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:360)
09-01 00:06:24.415: W/System.err(9961): at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1054)
09-01 00:06:24.415: W/System.err(9961): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1384)
09-01 00:06:24.415: W/System.err(9961): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1651)
09-01 00:06:24.415: W/System.err(9961): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1497)
09-01 00:06:24.415: W/System.err(9961): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1461)
Having found Java flag to enable extended Serialization debugging info I decided to set
-Dsun.io.serialization.extendedDebugInfo=true
Following How can I specify the default JVM arguments for programs I run from eclipse? I plugged the flag into the VM argument for my JRE, but the stack trace did not change. Rebooting Eclipse did not help. So following Editing the vm args of eclipse I added the flag to my eclipse.ini, but still the stack trace is unchanged. I'm expecting an output that looks something like java.io.NotSerializableException – but where is the field?.
I get it that com.myprogram.main.Entity$1
is not serializable. That's easy. The question is why? Any suggestions as to how I might figure out this java.io.NotSerializableException
?