The conf is imutable once the spark context is created. You need to create a new conf first and then pass it to the SparkContext constructor.