Unable to serialize object in variable

The problem is indeed that serialization can change slightly between JDK versions. The alternative is to not rely on serializable objects, but to store the variables in a format that is not prone to these changes, for example by transforming the object to a json variable (JsonNode) and back.