小编use*_*538的帖子

即使实现了工具界面警告也是如此

我有一个非常简单的"Hello world"风格地图/减少工作.

public class Tester extends Configured implements Tool {

    @Override
    public int run(String[] args) throws Exception {
        if (args.length != 2) {
            System.err.printf("Usage: %s [generic options] <input> <output>\n",
                getClass().getSimpleName());
            ToolRunner.printGenericCommandUsage(System.err);
            return -1;
        }

        Job job = Job.getInstance(new Configuration());
        job.setJarByClass(getClass());


        getConf().set("mapreduce.job.queuename", "adhoc");

        FileInputFormat.addInputPath(job, new Path(args[0]));
        FileOutputFormat.setOutputPath(job, new Path(args[1]));

        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(NullWritable.class);
        job.setMapperClass(TesterMapper.class);
        job.setNumReduceTasks(0);

        return job.waitForCompletion(true) ? 0 : 1;
    }

    public static void main(String[] args) throws Exception {
        int exitCode = ToolRunner.run(new Tester(), args);
        System.exit(exitCode);
    }
Run Code Online (Sandbox Code Playgroud)

它实现了ToolRunner,但是在运行时没有解析参数.

$hadoop jar target/manifold-mapreduce-0.1.0.jar ga.manifold.mapreduce.Tester …
Run Code Online (Sandbox Code Playgroud)

java hadoop mapreduce hortonworks-data-platform

6
推荐指数
1
解决办法
6428
查看次数