没有找到org.apache.hadoop.classification.InterfaceAudience的Cloudera Hadoop类文件

时间:2012-09-20 15:52:46

标签: compilation hadoop javac cloudera word-count

这是我在尝试编译此WordCount.java文件时遇到的错误。

$javac -classpath /usr/lib/hadoop/hadoop-common-2.0.0-cdh4.0.1.jar:/usr/lib/hadoop/client/hadoop-mapreduce-client-core-2.0.0-cdh4.0.1.jar -d ~/wordcount /usr/lib/hadoop/wordcount_classes/WordCount.java
/usr/lib/hadoop/hadoop-common-2.0.0-cdh4.0.1.jar(org/apache/hadoop/fs/Path.class): 

warning: Cannot find annotation method 'value()' in type 'LimitedPrivate': class file for org.apache.hadoop.classification.InterfaceAudience not found
1 warning

5 个答案:

答案 0 :(得分:12)

答案 1 :(得分:4)

我如何解决这个问题的步骤:

  1. 我创建了一个名为wordcount(/home/cloudera/wordcount)的目录。
  2. WordCount.java添加到/home/cloudera/wordcount目录。
  3. 在目录中我运行了以下命令:

    javac \
    -cp /usr/lib/hadoop/\*:/usr/lib/hadoop/client-0.20/\*:/usr/lib/hadoop/lib/\* \
    WordCount.java 
    -d /home/cloudera/wordcount/wordcount_classes
    

答案 2 :(得分:2)

对于Hadoop 2.6.0版,您需要添加以下jar:

javac -classpath $ HADOOP_HOME / share / hadoop / common / hadoop-common-2.6.0.jar:$ HADOOP_HOME / share / hadoop / common / lib / hadoop-annotations-2.6.0.jar:$ HADOOP_HOME / share /hadoop/mapreduce/hadoop-mapreduce-client-core-2.6.0.jar /path_to_your_java_file/WordCount.java

答案 3 :(得分:0)

hadoop-2.6.x中的快速(但不建议生产)是

的Unix / MacOS的

$ javac -classpath .:$(mapred classpath):$CLASSPATH -d ~/wordcount /usr/lib/hadoop/wordcount_classes/WordCount.java

答案 4 :(得分:0)

如果你有pom,请从pom评论下面的依赖

    <dependency>
        <groupId>org.apache.hive</groupId>
        <artifactId>hive-exec</artifactId>
        <version>1.2.1</version>
    </dependency>

然后启用hadoop-annotations