noclassdeffounderror:org/apache/commons/lang/stringutils

92dk7w1h  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(716)

我正在编写map reduce程序来比较两个文件。当我运行该程序时,它会引发以下异常。

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
at org.apache.hadoop.metrics2.lib.MutableMetricsFactory.getName(MutableMetricsFactory.java:119)

我的pom文件。

<dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>0.20.2</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-core</artifactId>
<version>0.23.1</version>
</dependency>
<dependency>
    <artifactId>guava</artifactId>
    <groupId>com.google.guava</groupId>
    <type>jar</type>
    <version>15.0</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
 <dependency>
 <groupId>org.apache.commons</groupId>
 <artifactId>commons-lang3</artifactId>
 <version>3.3</version>
  </dependency>
 <dependency>
  <groupId>commons-logging</groupId>
 <artifactId>commons-logging</artifactId>
 <version>1.1.1</version>
 </dependency>
</dependencies>

任何帮助都将不胜感激。

h7wcgrx3

h7wcgrx31#

作为错误消息 java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils 告诉您,您需要添加commons lang作为依赖项:

<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
<dependency>
    <groupId>commons-lang</groupId>
    <artifactId>commons-lang</artifactId>
    <version>2.3</version>
</dependency>

您已添加 commons-lang3 它还有一个类stringutils,但具有包名 org/apache/commons/lang3/StringUtils .

相关问题