title: Spark streaming output not saved to HDFS file
body: <p>I am trying to save the Spark streaming output to a file on HDFS. Right now, it is not saving any file.</p>
  
  <p>Here is my code :</p>
  
  <pre><code>StreamingExamples.setStreamingLogLevels();
  
  SparkConf sparkConf = new SparkConf().setAppName("MyTestCOunt");
  JavaStreamingContext ssc = new JavaStreamingContext(sparkConf,  new Duration(1000));
  
  JavaReceiverInputDStream&lt;String&gt; lines = ssc.socketTextStream(args[0], Integer.parseInt(args[1]), StorageLevels.MEMORY_AND_DISK_SER);
  JavaDStream&lt;String&gt; words = lines.flatMap(new FlatMapFunction&lt;String, String&gt;() {
                  @Override
                  public Iterable&lt;String&gt; call(String x) {
                   return  Lists.newArrayList(SPACE.split(x));
                  }
        });
  
  JavaPairDStream&lt;String, Integer&gt; wordCounts = words.mapToPair(
        new PairFunction&lt;String, String, Integer&gt;() {
          @Override
          public Tuple2&lt;String, Integer&gt; call(String s) {
                   return new Tuple2&lt;String, Integer&gt;(s, 1);
          }
        }).reduceByKey(new Function2&lt;Integer, Integer, Integer&gt;() {
          @Override
          public Integer call(Integer i1, Integer i2) {
            return i1 + i2;
          }
    }); 
  
  
  wordCounts.print();
  wordCounts.saveAsHadoopFiles("hdfs://mynamenode:8020/user/spark/mystream/","abc");
  ssc.start();
  ssc.awaitTermination();
  </code></pre>
  
  <p><code>wordCounts.print()</code> works, but not <code>wordCounts.saveAsHadoopFiles</code>, any ideas why ?</p>
  
  <p>I am running below commands :</p>
  
  <p>1) <code>nc -lk 9999</code></p>
  
  <p>2) <code>./bin/run-example org.apache.spark.examples.streaming.NetworkWordCount localhost 9999</code></p>
  
  <p>Thanks in advance..!!!</p>