运行spark-submit遇到如下报错:Exception in thread “main” java.lang.IllegalArgumentException: Wrong FS: hdfs://******, expected: file:///
原因:conf.addResource(file:Path)的参数需要是一个Path类的实例,而不是String类的实例,所以如果这么写是不对的:conf.addResource("/opt/hadoop-2.6.0/etc/hadoop/core-site.xml")
解决方法:正确写法是conf.addResource(new Path("/opt/hadoop-2.6.0/etc/hadoop/core-site.xml"))