今天编程又遇到问题了,完整报错如下:
Exception in thread "main" java.lang.NoSuchMethodException: org.apache.zookeeper.server.quorum.QuorumPeer.main([Ljava.lang.String;) at java.lang.Class.getMethod(Class.java:1786) at org.apache.hadoop.util.RunJar.run(RunJar.java:215) at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
解决方法:我们可以将之前的jar包删除,然后重新创建一个jar包,并在创建jar包时设置一个主类
再跑一次应该就能成功了,如果还不行的话,可以将驱动类(如下)job的输入路径与输出路径互换一下
package S1; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.DoubleWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import java.io.IOException; public class main1 { public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException { Job job= Job.getInstance(new Configuration()); job.setJarByClass(main1.class); job.setMapperClass(map1.class); job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(DoubleWritable.class); //指定job的reducer和输出类型 job.setReducerClass(reducer1.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); //指定job的输入和输出路径 FileInputFormat.setInputPaths(job,new Path(args[1])); FileOutputFormat.setOutputPath(job,new Path(args[0])); //执行任务 job.waitForCompletion(true); } }
再跑一次就出来了
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)