0

サーバーに Hadoop 環境があり、現在はローカル PC で開発を行っています。Eclipse で MapReduce クラス (Mapper クラスを上書きするのみ) を作成し、対応する構成をメイン メソッドに設定しました。Eclipse でプログラムを実行したいと考えています。 、しかし、「Debug As: Junit Test」中に問題が発生しました。次のようにエラー情報を取得します。


java.lang.Exception: メソッド main にはパラメータを指定しないでください ......


ジャババーチャルマシーンローンチャー

メイン クラスが見つかりませんでした: TestMapReduceDecodeAndCompressSelfSetting.class。プログラムは終了します。

4

1 に答える 1

0

Windows マシンの Eclipse で Map Reduce を実行するには、hadoop-7682 Java ファイルをダウンロードする必要があります。以下のようにconfファイルでこのファイルを参照してください。

config.set("fs.file.impl", "com.assignment.WinLocalFileSystem");

ここで、WinLocalFileSystem は Java クラスです。

参考までにサンプルコードを添付します。

Configuration config = new Configuration();
    config.set("mapreduce.input.keyvaluelinerecordreader.key.value.separator", " ");
    config.set("mapred.textoutputformat.separator", " --> ");
    config.set("fs.file.impl", "com.assignment.WinLocalFileSystem");

    String inputPath="In\\VISA_Details.csv";
    Path inPath=new Path(inputPath);
    String outputPath = "C:\\Users\\Desktop\\Hadoop Learning\\output\\run1";
    Path outPath=new Path(outputPath);

    Job job = new Job(config,"VISA: Total count on each day");
    job.setInputFormatClass(TextInputFormat.class);
    job.setOutputFormatClass(TextOutputFormat.class);

    job.setMapOutputKeyClass(Text.class);
    job.setMapOutputValueClass(Text.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(Text.class);

    job.setMapperClass(VisaMapper.class);
    job.setReducerClass(VisaReducer.class);

    FileInputFormat.setInputPaths(job, inPath );
    FileOutputFormat.setOutputPath(job, outPath);

    System.out.println(job.waitForCompletion(true));
于 2013-11-26T09:43:16.443 に答える