Serialization: Can't find non-serializable component of desired serialized object

191 views Asked by At

I got an object which should be serialized. Atm I let it implement Serializable but in runtime I get an

Failed to marshal object with optimized marhshaller:{ $heresAhugeString$ }
Failed to serialize object: { $alsoHugeString$ } 
java.io.IOException: Externalizable class doesn't have default constructor: interface java.io.Externalizable 
Externalizable class doesn't have default constructor: interface java.io.Externalizable
java.io.Externalizable.<init>()   

The last exception (java.io.Externalizable.() comes infinite times) I try to find the non-serializable field but I only can see that it throws exception at serializing a ConcurrentHashMap. I know this aren't much information but the complete stacktrace is quite big. Any tips how to find out which field in the map is responsible for non-serialization ? Or which information should I add ? Regards

1

There are 1 answers

0
rvillablanca On

I don't know what type of deserialization you are doing, but if you don't need use this field after unmarshalling, then you must set it as transient.

The transient java keyword can be used if your are use the Java Serialization, or @Transient if you are using JPA, or even @JsonIgnoreProperties if you are using Jackson