hadoop2.2.0源码编译笔记

本文介绍如何解决 Hadoop 2.2.0 源码编译过程中遇到的特定错误,并提供了解决方案,包括添加必要的依赖项以确保编译成功。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

sudo apt-get install g++ autoconf automake libtool make cmake zlib1g-dev pkg-config libssl-dev
sudo apt-get install ssh
sudo apt-get install protobuf-compiler
sudo apt-get install maven
进入 hadoop-2.2.0-src 目录
mvn package -Pdist,native -DskipTests -Dtar
如果在编译时出现如下的错误:
[INFO] ------------------------------------------------------------------------  
[INFO] BUILD FAILURE  
[INFO] ------------------------------------------------------------------------  
[INFO] Total time: 1:29.469s  
[INFO] Finished at: Mon Nov 18 12:30:36 PST 2013  
[INFO] Final Memory: 37M/120M  
[INFO] ------------------------------------------------------------------------  
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (default-testCompile) on project hadoop-auth: Compilation failure: Compilation failure:  
[ERROR] /home/chuan/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[84,13] cannot access org.mortbay.component.AbstractLifeCycle  
[ERROR] class file for org.mortbay.component.AbstractLifeCycle not found  
[ERROR] server = new Server(0);  
[ERROR] /home/chuan/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[94,29] cannot access org.mortbay.component.LifeCycle  
[ERROR] class file for org.mortbay.component.LifeCycle not found  
[ERROR] server.getConnectors()[0].setHost(host);  
[ERROR] /home/chuan/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[96,10] cannot find symbol  
[ERROR] symbol  : method start()  
[ERROR] location: class org.mortbay.jetty.Server  
[ERROR] /home/chuan/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[102,12] cannot find symbol  
[ERROR] symbol  : method stop()  




目前的2.2.0 的Source Code 压缩包解压出来的code有个bug 需要patch后才能编译。否则编译hadoop-auth 会提示上面错误。
解决办法如下:


修改下面的pom文件。该文件在hadoop源码包下寻找:




hadoop-common-project/hadoop-auth/pom.xml
打开上面的的pom文件,在56行加入如下的依赖:


     <dependency>
       <groupId>org.mortbay.jetty</groupId>
      <artifactId>jetty-util</artifactId>
      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.mortbay.jetty</groupId>
       <artifactId>jetty</artifactId>
       <scope>test</scope>
     </dependency>


重新编译
编译好的文件位于 hadoop-2.2.0-src/hadoop-dist/target/hadoop-2.2.0/ 目录中
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值