阅读背景:

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

来源:互联网 

Here is the error I get when trying to compile this WordCount.java file.

这是我在尝试编译此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 个解决方案

#1


12  

Add hadoop-annotations-2.0.0-cdh4.0.1.jar to the classpath

将hadoop-annotations-2.0.0-cdh4.0.1.jar添加到类路径中

#2


4  

Steps how I fixed this problem:

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

  1. I created a directory called wordcount (/home/cloudera/wordcount).
  2. 我创建了一个名为wordcount的目录(/ home / cloudera / wordcount)。
  3. Added WordCount.java to /home/cloudera/wordcount directory.
  4. 将WordCount.java添加到/ home / cloudera / wordcount目录。
  5. Inside the directory I ran the following command:

    在目录中我运行了以下命令:

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

#3


2  

For Hadoop version 2.6.0 you need to add the following jars:

对于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

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

#4


0  

A fast (but not advisable for production) in hadoop-2.6.x is

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

Unix/MacOS

在Unix / MacOS的

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

#5


0  

Comment the below dependency from the pom if you have it

如果你有pom,请从pom中注释下面的依赖关系

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

And then enable hadoop-annotations

然后启用hadoop-annotations


分享到: