I posted on this issue in http://apache-spark-user-list.1001560.n3.nabble.com/How-to-access-objects-declared-and-initialized-outside-the-call-method-of-JavaRDD-td17094.html#a17150
Code starts public class SparkUtilities extends Serializable private transient static ThreadLocal<JavaSparkContext> threadContext; private static String appName = "Anonymous"; essentially you need to get a context on the slave machine saving it in a transient (non serialized) field - at least that is what you want to do in Java -- View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/java-io-NotSerializableException-org-apache-spark-SparkEnv-tp10641p18072.html Sent from the Apache Spark User List mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@spark.apache.org For additional commands, e-mail: user-h...@spark.apache.org