2016-11-15 104 views
0

Vesions齊柏林星火解釋(sc.textFile)拋出的NoSuchMethodError

飛艇版本:0.7快照版本。

星火1.6

CDH 5.7.1

斯卡拉2.10

sc.textFile導致

java.lang.NoSuchMethodError: org.apache.hadoop.fs.BlockLocation.<init>([Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;JJZ)V

val dataset=sc.textFile("/tmp/expenses.csv") 
dataset.count() 
dataset.first() 

全STRACK跟蹤

dataset: org.apache.spark.rdd.RDD[String] = /tmp/expenses.csv MapPartitionsRDD[1] at textFile at <console>:29 
java.lang.NoSuchMethodError: org.apache.hadoop.fs.BlockLocation.<init>([Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;JJZ)V 
at org.apache.hadoop.hdfs.DFSUtil.locatedBlocks2Locations(DFSUtil.java:522) 
at org.apache.hadoop.hdfs.DFSUtil.locatedBlocks2Locations(DFSUtil.java:486) 
at org.apache.hadoop.hdfs.DFSClient.getBlockLocations(DFSClient.java:1305) 
at org.apache.hadoop.hdfs.DistributedFileSystem$1.doCall(DistributedFileSystem.java:221) 
at org.apache.hadoop.hdfs.DistributedFileSystem$1.doCall(DistributedFileSystem.java:217) 
at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81) 
at org.apache.hadoop.hdfs.DistributedFileSystem.getFileBlockLocations(DistributedFileSystem.java:217) 
at org.apache.hadoop.hdfs.DistributedFileSystem.getFileBlockLocations(DistributedFileSystem.java:209) 
at org.apache.hadoop.mapred.FileInputFormat.getSplits(FileInputFormat.java:343) 
at org.apache.spark.rdd.HadoopRDD.getPartitions(HadoopRDD.scala:199) 
at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239) 
at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237) 
at scala.Option.getOrElse(Option.scala:120 

回答

1

看來二進制兼容性被破壞了。

我想你應該建立一個使用適當的Hadoop配置文件(CDH 5.7)

您可以參考建資料,在本頁面

這些都可以Hadoop的配置文件在0.7.0-SNAPSHOT

-Phadoop-0.23 -Phadoop-1 -Phadoop-2.2 -Phadoop-2.3 -Phadoop-2.4 -Phadoop-2.6

+0

謝謝你的 「二進制兼容性」 線索@ 1ambda。用'hadoop-common-2.6.0-cdh5.7.1.jar'替換了'zeppelin-server/target/lib/hadoop-common-2.6.0.jar',它工作的很好。 –