title: "java.io.IOException: Can't get Master Kerberos principal for use as renewer" while read csv from cluster
body: <p>I'm using scala version 2.11.4 with spark 2.1.1 and hadoop version 2.6.0-cdh5.7.1. below is the code snippets I'm using to read csv file but getting into "java.io.IOException: Can't get Master Kerberos principal for use as renewer". I'm running this program from my intelliji connecting to cloudera cluster from my local. I'm using kerberos authentication to connect to cluster. upto the line "diamonds.printSchema", the program executes perfectly but it fails while trying to read CSV file but can able to read csv file as sqlContext.read.textFile("/tmp/xyz/data.csv"). I tried google it, but no luck so far.  the issue log <a href="https://issues.apache.org/jira/browse/SPARK-20328" rel="nofollow noreferrer">https://issues.apache.org/jira/browse/SPARK-20328</a> seems to be related but couldn't get what's the workaround.   has anyone encountered this issue?  appreciate your help</p>
  
  <pre><code>val spark: SparkSession = {
    SparkSession
      .builder()
      .master(master)
      .appName(appName)
      .enableHiveSupport()
      .getOrCreate()
  }
  val sqlContext = spark.sqlContext
  var parquet = sqlContext.read.parquet("../data.parquet/part.snappy.parquet")
  parquet.printSchema()
  //parquet.write.mode(SaveMode.Append).save("/tmp/xyz/data.parquet")
  val diamonds = sqlContext.read.textFile("/tmp/xyz/data.csv")
  diamonds.printSchema
  val readcsv = sqlContext.read.format("com.databricks.spark.csv").option("header", "true") .load("/tmp/xyz/data.csv")
  </code></pre>
  
  <p>I'm running into below issue while trying to access csv file from cloudera cluster.</p>
  
  <p>Exception in thread "main" java.io.IOException: Can't get Master Kerberos principal for use as renewer
      at org.apache.hadoop.mapreduce.security.TokenCache.obtainTokensForNamenodesInternal(TokenCache.java:133)
      at org.apache.hadoop.mapreduce.security.TokenCache.obtainTokensForNamenodesInternal(TokenCache.java:100)
      at org.apache.hadoop.mapreduce.security.TokenCache.obtainTokensForNamenodes(TokenCache.java:80)
      at org.apache.hadoop.mapred.FileInputFormat.listStatus(FileInputFormat.java:206)
      at org.apache.hadoop.mapred.FileInputFormat.getSplits(FileInputFormat.java:315)
      at org.apache.spark.rdd.HadoopRDD.getPartitions(HadoopRDD.scala:202)
      at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:252)
      at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:250)
      at scala.Option.getOrElse(Option.scala:120)
      at org.apache.spark.rdd.RDD.partitions(RDD.scala:250)
      at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
      at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:252)
      at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:250)
      at scala.Option.getOrElse(Option.scala:120)
      at org.apache.spark.rdd.RDD.partitions(RDD.scala:250)
      at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
      at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:252)
      at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:250)
      at scala.Option.getOrElse(Option.scala:120)
      at org.apache.spark.rdd.RDD.partitions(RDD.scala:250)
      at org.apache.spark.rdd.RDD$$anonfun$take$1.apply(RDD.scala:1333)
      at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
      at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
      at org.apache.spark.rdd.RDD.withScope(RDD.scala:362)
      at org.apache.spark.rdd.RDD.take(RDD.scala:1327)
      at org.apache.spark.rdd.RDD$$anonfun$first$1.apply(RDD.scala:1368)
      at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
      at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
      at org.apache.spark.rdd.RDD.withScope(RDD.scala:362)
      at org.apache.spark.rdd.RDD.first(RDD.scala:1367)
      at org.apache.spark.sql.execution.datasources.csv.CSVFileFormat.findFirstLine(CSVFileFormat.scala:206)
      at org.apache.spark.sql.execution.datasources.csv.CSVFileFormat.inferSchema(CSVFileFormat.scala:60)
      at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$7.apply(DataSource.scala:184)
      at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$7.apply(DataSource.scala:184)
      at scala.Option.orElse(Option.scala:288)
      at org.apache.spark.sql.execution.datasources.DataSource.org$apache$spark$sql$execution$datasources$DataSource$$getOrInferFileFormatSchema(DataSource.scala:183)
      at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:387)
      at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:152)
      at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:135)
      at LoadCSV$.main(LoadCSV.scala:44)
      at LoadCSV.main(LoadCSV.scala)</p>