找不到Hadoop jar执行失败的类 [英] Hadoop jar execution failing on class not found
问题描述
我正在运行hadoop作业,但在找不到类时失败。总共4个Java文件。
I am running my hadoop job and it is failing on class not found. 4 java files in total.
logProcessor.java
logMapper.java
logReducer.java
logParser.java
所有内容都位于unix上的com文件夹中,并且我有 package com;在所有类的第一行中
Everything is in a com folder on unix and I have "package com;" in the first line in all classes
这意味着如果您在命令
头下执行-5 * java
您将看到
软件包com;所有4个文件中的
。
that means if you do below command head -5 *java You will see package com; in all 4 files.
logProcessor是Driver类。所有文件都位于UNIX上的 com文件夹中。
logProcessor is the Driver class. All files are in "com" folder on unix.
ls -ltr com/
logProcessor.java
logMapper.java
logReducer.java
logParser.java
I compiled the java program and made a jar out of it.
hadoop jar /var/lib/hadoop-hdfs/xxxx/jarFiles/LogParser.jar com.LogProcessor /user/hdfs/flume/2015-03-30/03 /user/xxxx/output_xxx
它给了我以下错误:
Exception in thread "main" java.lang.ClassNotFoundException: com.RFCLogProcessor
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at org.apache.hadoop.util.RunJar.main(RunJar.java:201)
推荐答案
我所做的一切都是正确的。
Everything that I was doing was right. Except that the classes which got created didnt have execute permission on them
所以我做了
chmod -R 777,只是创建的类没有执行权限。 com /
chmod -R 777 com/
并再次罐装它,然后使用相同的上述命令运行它并执行。
and jar'd it again and ran it with same above command and it executed.
这篇关于找不到Hadoop jar执行失败的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!