已解决:
1.复制hdfs-site.xml到spark的配置目录
2.复制core-site.xml到spark的配置目录
3.修改spark的配置文件spark-defaults.conf
加上:
spark.files file:///opt/cluster/spark-1.6.1-bin-hadoop2.4/conf/hdfs-site.xml,file:///opt/cluster/spark-1.6.1-bin-hadoop2.4/conf/core-site.xml 配置即可