hadoop客户端提交作业错误:java.lang.RuntimeException: java.lang.ClassNotFoundException: Job$Mappe
2014-11-10 18:49
471 查看
Eclipse远程调用hadoop出错:java.lang.RuntimeException: java.lang.ClassNotFoundException: Job$Mappe
转自:
http://my.oschina.net/mkh/blog/340112 http://www.cnblogs.com/chenying99/archive/2013/06/02/3113474.html http://www.linuxidc.com/Linux/2012-02/54711.htm (http://techme.lofter.com/post/ccd6e_1e772b)
eclipse直接提交mapreduce任务所需环境配置代码如下所示:
添加类EJob
修改后的wordcount代码如下(转自别人的,我没测过)
?
或者这样调用(本人测试过)
public static void main(String[] args) throws Exception {
// Add these statements. XXX
File jarFile = EJob.createTempJar("bin");
EJob.addClasspath("/usr/hadoop-1.2.1/conf");//好像不加这句也可以,没有什么用
ClassLoader classLoader = EJob.getClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
Configuration conf = new Configuration();
conf.set("mapred.job.tracker", "Master.Hadoop:54311");
String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
if (otherArgs.length != 2) {
System.err.println("Usage: wordcount <in> <out>");
System.exit(2);
}
Job job = new Job(conf, "word count");
((JobConf)job.getConfiguration()).setJar(jarFile.toString());
job.setJarByClass(WordCount.class);
job.setMapperClass(TokenizerMapper.class);
job.setCombinerClass(IntSumReducer.class);
job.setReducerClass(IntSumReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
不加 conf.set("mapred.job.tracker", "Master.Hadoop:54311");会出错
参考文献:https://issues.apache.org/jira/browse/HADOOP-8089
错误信息如下:
ERROR security.UserGroupInformation: PriviledgedActionException as: hadoop cause:java.io.IOException Failed to set permissions of path:\usr\hadoop\tmp\mapred\staging\hadoop753422487\.staging
to 0700 Exception in thread "main" java.io.IOException: Failed to set permissions of path: \usr\hadoop\tmp \mapred\staging\hadoop753422487\.staging to
0700
解决方法:
Configuration conf = new Configuration();
conf.set("mapred.job.tracker", "[server]:9001");
转自:
http://my.oschina.net/mkh/blog/340112 http://www.cnblogs.com/chenying99/archive/2013/06/02/3113474.html http://www.linuxidc.com/Linux/2012-02/54711.htm (http://techme.lofter.com/post/ccd6e_1e772b)
eclipse直接提交mapreduce任务所需环境配置代码如下所示:
添加类EJob
?
public static void main(String[] args) throws Exception {
// Add these statements. XXX
File jarFile = EJob.createTempJar("bin");
EJob.addClasspath("/usr/hadoop-1.2.1/conf");//好像不加这句也可以,没有什么用
ClassLoader classLoader = EJob.getClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
Configuration conf = new Configuration();
conf.set("mapred.job.tracker", "Master.Hadoop:54311");
String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
if (otherArgs.length != 2) {
System.err.println("Usage: wordcount <in> <out>");
System.exit(2);
}
Job job = new Job(conf, "word count");
((JobConf)job.getConfiguration()).setJar(jarFile.toString());
job.setJarByClass(WordCount.class);
job.setMapperClass(TokenizerMapper.class);
job.setCombinerClass(IntSumReducer.class);
job.setReducerClass(IntSumReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
不加 conf.set("mapred.job.tracker", "Master.Hadoop:54311");会出错
参考文献:https://issues.apache.org/jira/browse/HADOOP-8089
错误信息如下:
ERROR security.UserGroupInformation: PriviledgedActionException as: hadoop cause:java.io.IOException Failed to set permissions of path:\usr\hadoop\tmp\mapred\staging\hadoop753422487\.staging
to 0700 Exception in thread "main" java.io.IOException: Failed to set permissions of path: \usr\hadoop\tmp \mapred\staging\hadoop753422487\.staging to
0700
解决方法:
Configuration conf = new Configuration();
conf.set("mapred.job.tracker", "[server]:9001");
相关文章推荐
- Hadoop客户端提交作业时java.lang.ClassNotFoundException
- 用JSON报的一个错误java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeExcep
- 运行hadoop jar 报错java.lang.RuntimeException: java.lang.ClassNotFoundException: xxxxMapper及mapreduce执行
- 用JSON报的一个错误java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeExcept
- 用JSON报的一个错误java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeExcept
- 【转】用JSON报的一个错误java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeExcept
- 用JSON报的一个错误java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeExcept
- 用JSON报的一个错误java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeExcept
- 运行mapreduce程序时出现异常java.lang.RuntimeException: java.lang.ClassNotFoundException的原因
- Rational Rose 启动和退出的错误,提示java.lang.ClassNotFoundException
- 使用JSON报的一个错误java.lang.ClassNotFoundException
- java.lang.ClassNotFoundException: org.apache.hadoop.util.PlatformName
- java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException
- 配置完struts,tomcat运行错误java.lang.ClassNotFoundException: org.apache.struts.action.ActionServlet
- java.lang.ClassNotFoundException: org.apache.catalina.loader.DevLoader 错误
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener错误解决方案
- java.lang.RuntimeException: java.lang.ClassNotFoundException: xxxxMapper
- Spring-Flex与Hibernate 4集成出现错误 ,java.lang.ClassNotFoundException: org.hibernate.collection.Persisten
- 用JSON报错 java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeExcept .
- spring 错误 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderServlet