11宁静致远
2018-03-06 19:35
运行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运行失败");
}
}
}
具体一点吧这个报的什么呀
Hadoop进阶
24208 学习 · 68 问题
相似问题