“Task not serializable” with java time in Spark-shell (or zeppelin) but not in spark-submit
问题 Weirdly, I found several times there's difference when running with spark-submit vs running with spark-shell (or zeppelin), though I don't believe it. With some codes, spark-shell (or zeppelin) can throw this exception, while spark-submit just works fine: org.apache.spark.SparkException: Task not serializable at org.apache.spark.util.ClosureCleaner$.ensureSerializable(ClosureCleaner.scala:345) at org.apache.spark.util.ClosureCleaner$.org$apache$spark$util$ClosureCleaner$$clean(ClosureCleaner