java.io.IOException: No input paths specified in job
log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
java.io.IOException: No input paths specified in job
step1運(yùn)行失敗~~~
at org.apache.hadoop.mapreduce.lib.input.FileInputFormat.listStatus(FileInputFormat.java:239)
at org.apache.hadoop.mapreduce.lib.input.FileInputFormat.getSplits(FileInputFormat.java:387)
at org.apache.hadoop.mapreduce.JobSubmitter.writeNewSplits(JobSubmitter.java:301)
at org.apache.hadoop.mapreduce.JobSubmitter.writeSplits(JobSubmitter.java:318)
at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:196)
at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1290)
at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1287)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Unknown Source)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1758)
at org.apache.hadoop.mapreduce.Job.submit(Job.java:1287)
請(qǐng)問一下各位大神,這個(gè)情況有遇到的嗎?百度了各種情況,都 沒有解決,
2019-07-31
你的主機(jī)名是localhost找host文件的時(shí)候,轉(zhuǎn)為在你的運(yùn)行電腦上,也就是本機(jī),并不是虛擬機(jī),所以就沒有那個(gè)文件,建議修改虛擬機(jī)主機(jī)名,或者修改hosts文件。
2019-05-05
沒有,它變成了另外一個(gè)錯(cuò)誤,你要在編譯器中連接虛擬機(jī),還要添加相關(guān)的矩陣文件
2019-04-25
好像不是這個(gè)原因
2019-04-25
我也有這個(gè)問題,我在想是不是虛擬機(jī)連接問題
2019-04-25
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.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
public class MR1 {
? ? //輸入文件相對(duì)路徑
private static String inPath = "/matrix/step1_input/matrix_2.txt";
//輸出文件的相對(duì)路徑
private static String outPath = "/matrix/step1_output";
//hdfs的地址
private static String hdfs = "hdfs://localhost:9000";
public int run() {
try {
//創(chuàng)建job配置類
Configuration conf = new Configuration();
//設(shè)置hdfs的地址
conf.set("cf.defaultFS", hdfs);
//創(chuàng)建一個(gè)job實(shí)例
Job job = Job.getInstance(conf,"step1");
//設(shè)置job 的主類
job.setJarByClass(MR1.class);
//設(shè)置job 的mapper類及reducer類
job.setMapperClass(Mapper1.class);
job.setReducerClass(Reducer1.class);
//設(shè)置mapper輸出的類型
job.setMapOutputKeyClass(Text.class);
job.setMapOutputValueClass(Text.class);
//設(shè)置reducer輸出類型
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
FileSystem fs =FileSystem.get(conf);
//設(shè)置輸入和輸出路徑
Path inputPath = new Path(inPath);
if(fs.exists(inputPath)) {
FileInputFormat.addInputPath(job, inputPath);
}
Path outputPath = new Path(outPath);
fs.delete(outputPath,true);
?
FileOutputFormat.setOutputPath(job, outputPath);
return job.waitForCompletion(true)?1:-1;
} catch (IOException | ClassNotFoundException | InterruptedException e) {
e.printStackTrace();
}
return -1;
}
public static void main(String[] args) {
int result = -1;
result =new MR1().run();
if(result == 1) {
System.out.println("step1運(yùn)行成功~~~");
}else if(result == -1) {
System.out.println("step1運(yùn)行失敗~~~");
}
}
}
貼上源碼