Ubuntu系統下eclipse配置mapreduce外掛常見錯誤和解決辦法彙總

Thinkgamer_gyt發表於2015-08-03

在上篇文章中eclipse已經能訪問HDFS目錄( blog.csdn.net/gamer_gyt/article/details/47209623),但並不能進行Mapreduce程式設計,在這裡小編將常見錯誤和處理辦法進行總結,希望對大家有所幫助

錯誤1ERROR [main] util.Shell (Shell.java:getWinUtilsPath(303)) - Failed to locate the winutils binary in the hadoop binary path  
java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.

解決辦法:

eg:我解壓的目錄是D:\hadoop-2.6.0

在系統的環境變數介面新增HADOOP_HOME,並在系統變數PATH中新增如圖:

然後eclipse中選擇Windows->Prefenences設定如圖:

錯誤2:Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

錯誤3:Exception in thread "main" java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)Z

上面兩個問題是缺少元件,解決辦法:

下載hadoop-common-2.2.0-bin-master

將裡邊bin 目錄替換 本地hadoop裡邊的bin目錄


錯誤:4:

15/08/03 10:15:43 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
15/08/03 10:15:43 INFO client.RMProxy: Connecting to ResourceManager at /0.0.0.0:8032
15/08/03 10:15:55 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
15/08/03 10:15:57 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
15/08/03 10:15:59 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)

解決辦法:

將叢集配置檔案中core-site.xml  localhost改為你主節點IP

然後加入在yarn-site.xml中加入

<property>
<name>yarn.resourcemanager.address</name>
<value>127.0.0.1:8032</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>127.0.0.1:8030</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>127.0.0.1:8031</value>
</property>
<property>
<name>yarn.resourcemanager.hostname</name>
<value>127.0.0.1</value>
</property>
注意127.0.0.1改為你的ip

特別注意的是,修改後,叢集要重新啟動,且把裡邊的修改的檔案重新copy一份到程式的src目錄下,在eclipse中重新整理

錯誤5:

Exit code: 1
Exception message: /bin/bash: 第 0 行: fg: 無任務控制

Stack trace: ExitCodeException exitCode=1: /bin/bash: 第 0 行: fg: 無任務控制

解決辦法參考網上給的教程:http://www.aboutyun.com/thread-8498-1-1.html 並未解決

真正的辦法是:


在客戶端配置檔案中新增如下屬性:

    <property>
        <name>mapreduce.app-submission.cross-platform</name>
        <value>true</value>
    </property>
注意:必須新增到Hadoop程式讀取的客戶端本地配置檔案中,新增到客戶端Hadoop安裝路徑中的“core-site.xml”,“mapred-site.xml”等檔案中不起作用

錯誤6:

正確放置完jar外掛之後,eclipse中不能顯示mapreduce

解決辦法:檢查jar外掛的位置注意如果是從ubuntu自帶的軟體中心安裝elcipse的話,則安裝目錄為:/usr/share/eclipse/dropins/sdk/plugins/不是在/usr/share/eclipse/plugin,進入eclipse目錄,執行sudo chmod 777 * -R,重啟eclipse           這一步特別重要網上好多資料都不是這樣寫的,所以配置一直不成功。


推薦一篇不錯的部落格:http://www.aboutyun.com/thread-8311-1-1.html

相關文章