0
獲取此異常用Hadoop 2.5.1一個HTTP Servlet中org.apache.hadoop.fs.FileSystem:提供org.apache.hadoop.hdfs.DistributedFileSystem不是一個亞型
java.util.ServiceConfigurationError: org.apache.hadoop.fs.FileSystem: Provider org.apache.hadoop.hdfs.DistributedFileSystem not a subtype
的DistributedFileSystem類內使用時可在這些罐子
hadoop-core-1.2.1.jar
hadoop-hdfs-2.5.1.jar
發現當我單獨使用Hadoop的核心1.2.1.jar,編譯器錯誤,我得到的是HDFS架構未找到。
java.io.IOException: No FileSystem for scheme: hdfs
當我使用兩個罐子時,我得到上述錯誤。
在servlet中的代碼:
Configuration conf = new Configuration();
try {
System.out.println("keyword=" + keyWord);
conf.set("keyword", keyWord);
conf.set("fs.hdfs.impl",
org.apache.hadoop.fs.hdfs.DistributedFileSystem.class.getName()
);
Job job = Job.getInstance();
job.setJarByClass(HadoopServlet.class);
job.setJobName("Tomcat Log Error");
FileInputFormat.addInputPath(job, new Path("hdfs://master:54310/keyword/pg20417.txt"));
FileOutputFormat.setOutputPath(job, new Path("hdfs://master:54310/tmp/output" + uuid));
job.setMapperClass(TomcatLogErrorMapper.class);
job.setReducerClass(TomcatLogErrorReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
catch (Exception e) {
System.out.println("Error");
e.printStackTrace();
}
任何幫助理解。
發現這個線程
A Servlet Container on top of Hadoop?
看起來像一個不能使用servlet來運行Hadoop作業。
沒有你設法解決這個問題?我面臨同樣的問題。 – 2016-06-01 09:08:23