java.io.NotSerializableException – but where is the field?

To enable more informations about “java.io.NotSerializableException” just add the “-Dsun.io.serialization.extendedDebugInfo=true” VM argument to your run configuration.

Example: java -Dsun.io.serialization.extendedDebugInfo=true -jar your.jar

Without extendedDebugInfo:

Exception in thread "main" java.io.NotSerializableException: net.nautsch.addressbook.Country
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
at net.nautsch.addressbook.App.main(App.java:33)

and with:

Exception in thread "main" java.io.NotSerializableException: net.nautsch.addressbook.Country
- field (class "net.nautsch.addressbook.Address", name: "country", type: "class net.nautsch.addressbook.Country")
- object (class "net.nautsch.addressbook.Address", net.nautsch.addressbook.Address@13caecd)
- field (class "net.nautsch.addressbook.Person", name: "address", type: "class net.nautsch.addressbook.Address")
- root object (class "net.nautsch.addressbook.Person", net.nautsch.addressbook.Person@158b649)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1161)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
at net.nautsch.addressbook.App.main(App.java:33)

2 thoughts on “java.io.NotSerializableException – but where is the field?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s