運行主類報錯
運行hadoop主類的時候,一直出現這個錯,clean了項目也沒用:
錯誤: 找不到或無法加載主類 Step1.CF_MR1,能幫忙看下什么原因么:
package Step1;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider.Text;
public class CF_MR1 {
?? ?
?? ?private static String inPath="/ItemCF/step1_input/ActionList.txt";
?? ?
?? ?private static String outPath="/ItemCF/step1_output";
?? ?
?? ?private static String hdfs="hdfs://master:9000";
?? ?
?? ?public int run(){
?? ?try {
?? ??? ?
?? ??? ?Configuration conf=new Configuration();
?? ??? ?
?? ??? ?conf.set("fs.defaultFS", hdfs);
?? ??? ?
?? ??? ?Job job=Job.getInstance(conf,"step1");
?? ??? ?
?? ??? ?job.setJarByClass(CF_MR1.class);
?? ??? ?job.setMapperClass(Mapper1.class);
?? ??? ?job.setReducerClass(Reducer1.class);
?? ??? ?
?? ??? ?job.setMapOutputKeyClass(Text.class);
?? ??? ?job.setMapOutputValueClass(Text.class);
?? ??? ?
?? ??? ?job.setOutputKeyClass(Text.class);
?? ??? ?job.setOutputValueClass(Text.class);
?? ??? ?
?? ??? ?FileSystem fs=FileSystem.get(conf);
?? ??? ?Path inputPath=new Path(inPath);
?? ??? ?if(fs.exists(inputPath)){
?? ??? ??? ?org.apache.hadoop.mapreduce.lib.input.FileInputFormat.addInputPath(job, inputPath);
?? ??? ?}
?? ??? ?
?? ??? ?Path outputPath=new Path(outPath);
?? ??? ?fs.delete(outputPath, true);
?? ??? ?FileOutputFormat.setOutputPath(job, outputPath);
?? ??? ?
?? ??? ?try {
?? ??? ??? ?return job.waitForCompletion(true)?1:-1;
?? ??? ?} catch (ClassNotFoundException e) {
?? ??? ??? ?e.printStackTrace();
?? ??? ?} catch (InterruptedException e) {
?? ??? ??? ?e.printStackTrace();
?? ??? ?}
?? ??? ?
?? ??? ?} catch (IOException e) {
?? ??? ??? ?// TODO Auto-generated catch block
?? ??? ??? ?e.printStackTrace();
?? ??? ?}
?? ??? ?
?? ??? ?return -1;
?? ?}
?? ?
?? ?
?? ?public static void main(String[] args) {
?? ??? ?int result=-1;
?? ??? ?CF_MR1 mr1=new CF_MR1();
?? ??? ?result=mr1.run();
?? ??? ?if(result==1){
?? ??? ??? ?System.out.println("step1運行成功");
?? ??? ??? ?
?? ??? ?}else if(result==-1){
?? ??? ??? ?System.out.println("step1運行失敗");
?? ??? ?}
?? ??? ?
?? ?}
}
2022-03-06
具體一點吧這個報的什么呀