[ https://issues.apache.org/jira/browse/FLINK-15773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17024994#comment-17024994 ]
Aljoscha Krettek commented on FLINK-15773: ------------------------------------------ [~jvilcek] I think you're right! I don't know yet how that implementation of {{writeReplace}} works for subclasses of {{DateTimeZone}} but in Java {{writeReplace}} methods of superclasses are used. The situation is a bit complicated though: https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html: bq. This writeReplace method is invoked by serialization if the method exists and it would be accessible from a method defined within the class of the object being serialized. Thus, the method can have private, protected and package-private access. Subclass access to this method follows java accessibility rules. it's not enough that a superclass has the method but it must also be accessible from the subclass, which is the case for {{DateTimeZone}}. > ClosureCleaner fails with joda DateTimeZone > ------------------------------------------- > > Key: FLINK-15773 > URL: https://issues.apache.org/jira/browse/FLINK-15773 > Project: Flink > Issue Type: Bug > Components: API / Core > Affects Versions: 1.9.1 > Reporter: Jozef Vilcek > Priority: Minor > > Flink fails to launch my Apache Beam job which uses windowing function with > time zone. Closure cleaner reports time zone as not serializable. Part of > stack trace: > > {noformat} > org.joda.time.tz.DateTimeZoneBuilder$OfYear@3b035d0c is not serializable. The > object probably contains or references non serializable fields. > > org.apache.flink.api.java.ClosureCleaner.clean(ClosureCleaner.java:151) > > org.apache.flink.api.java.ClosureCleaner.clean(ClosureCleaner.java:126) > > org.apache.flink.api.java.ClosureCleaner.clean(ClosureCleaner.java:126) > > org.apache.flink.api.java.ClosureCleaner.clean(ClosureCleaner.java:126) > > org.apache.flink.api.java.ClosureCleaner.clean(ClosureCleaner.java:126) > > org.apache.flink.api.java.ClosureCleaner.clean(ClosureCleaner.java:126) > > org.apache.flink.api.java.ClosureCleaner.clean(ClosureCleaner.java:126) > org.apache.flink.api.java.ClosureCleaner.clean(ClosureCleaner.java:71) > org.apache.flink.api.java.DataSet.clean(DataSet.java:186) > org.apache.flink.api.java.DataSet.flatMap(DataSet.java:267) > ....{noformat} > Actual instance of DateTimeZone is > [PrecalculatedZone|https://github.com/JodaOrg/joda-time/blob/v2.10.5/src/main/java/org/joda/time/tz/DateTimeZoneBuilder.java#L1373] > which itself is serializable but it's fields are not necessarily standalone > java serializable, because enclosing class it managing their serialization > and deserialization. > > -- This message was sent by Atlassian Jira (v8.3.4#803005)