如果直接将下载Hadoop-eclipse-plugin-0.20.203.0.jar复制到eclipse的插件目录中,在连接DFS时会出现错误,提示信息为: "error: failure to login",弹出的错误提示框内容为"An internal error occurred during: "Connecting to DFS hadoop". org/apache/commons/configuration/Configuration". 经过察看Eclipse的log,发现是缺少jar包导致的。进一步查找资料后,发现直接复制hadoop-eclipse-plugin-0.20.203.0.jar,该包中lib目录下缺少了jar包。
首先要对hadoop-eclipse-plugin-0.20.203.0.jar进行修改。用归档管理器打开该包,发现只有commons-cli-1.2.jar和hadoop-core.jar两个包。将HADOOP_HOME/lib目录下的 commons-configuration-1.6.jar , commons-httpclient-3.0.1.jar , commons-lang-2.4.jar , jackson-core-asl-1.0.1.jar 和 jackson-mapper-asl-1.0.1.jar 等5个包复制到hadoop-eclipse-plugin-0.20.203.0.jar的lib目录下。
然后,修改该包META-INF目录下的MANIFEST.MF,将classpath修改为以下内容:
Bundle-ClassPath: classes/,lib/hadoop-core.jar,lib/commons-cli-1.2.jar,lib/commons-httpclient-3.0.1.jar,lib/jackson-core-asl-1.0.1.jar,lib/jackson-mapper-asl-1.0.1.jar,lib/commons-configuration-1.6.jar,lib/commons-lang-2.4.jar
然后安装插件就ok了,把这个文件放到 Eclipse的安装目录下的plugins,重新启动Eclipse,常规配置就能连接上hdfs。