AnsweredAssumed Answered

Showing classnot found exception org.apache.hadoop.fs.FSDataOutputStrea

Question asked by ashrumochan on Sep 16, 2015
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

/**
 *
 * @author bunty
 */
public class SimpleJavaHDFS
{

    /**
     * @param args the command line arguments
     */
    private BufferedWriter writer;
    Configuration configuration = null;
    FileSystem hdfs = null;
    FSDataOutputStream outputStream;
    String fsPath="/user/bunty/storm/stormoutput.txt";
    public SimpleJavaHDFS(String st)
    {
      Path path = new Path(fsPath);
      try
      {
         hdfs = FileSystem.get(new Configuration());
         outputStream = hdfs.append(path);
         writer = new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8"));
         writer.write("\n"+st);
         writer.flush();
      }
      catch(IOException e)
      {
          e.printStackTrace();
      }
    }
    public static void main(String[] args)
    {
        // TODO code application logic here
        String str = "Hello !!! Successfully written data into hdfs!!!!";
        SimpleJavaHDFS s = new SimpleJavaHDFS(str);       
    }
    
}


What is wrong with this program
showing runtime error: java.lang.Classnotfound.Exception:org.apache.hadoop.fs.FSDataOutputStream

Outcomes