Hadoop eclipse开发解决Call to localhost/127.0.0.1:9000 failed on local exception: java.io.EOFException
2013-12-28 10:41
537 查看
问题:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
应用环境
Hadoop: apache hadoop1.2.1
Eclipse Version: Kepler Service Release 1
计划在Eclipse中直接运行一些MapReduce测试程序,在 google code上下载了插件:hadoop-0.20.1-eclipse-plugin.jar,但是在配置hadoop location时却报错:
Call to localhost/127.0.0.1:9000 failed on local exception: java.io.EOFException,如图所示:
原因:Hadoop服务端版本和eclipse插件版本不一致。
解决方案:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
所以就重新编译了一个hadoop 1.2.1 eclipse plugin,编译过程如下:
1. 插件源代码在${hadoop源码目录}/src/contrib/eclipse-plugin下面,需要修改build.xml文件如下:
(Note:需要修改的地方已经用蓝色字体进行了标注,其他保持原本默认配置即可
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project default="jar" name="eclipse-plugin">
<!-- 增加如下这8个property配置 -->
<property name="name" value="${ant.project.name}" />
<property name="root" value="${basedir}" />
<property name="hadoop.root" location="haoop源码目录" />
<property name="version" value="1.2.1" />
<property name="eclipse.home" location="eclipse安装位置"/>
<property name="build.dir" location="${hadoop.root}/build/contrib/${name}"/>
<property name="build.classes" location="${build.dir}/classes"/>
<property name="src.dir" location="${root}/src/java"/>
<!-- end -->
<!-- 注释掉这个import语句 -->
<!--<import file="../build-contrib.xml"/>-->
<path id="eclipse-sdk-jars">
<fileset dir="${eclipse.home}/plugins/">
<include name="org.eclipse.ui*.jar"/>
<include name="org.eclipse.jdt*.jar"/>
<include name="org.eclipse.core*.jar"/>
<include name="org.eclipse.equinox*.jar"/>
<include name="org.eclipse.debug*.jar"/>
<include name="org.eclipse.osgi*.jar"/>
<include name="org.eclipse.swt*.jar"/>
<include name="org.eclipse.jface*.jar"/>
<include name="org.eclipse.team.cvs.ssh2*.jar"/>
<include name="com.jcraft.jsch*.jar"/>
</fileset>
</path>
<!-- Override classpath to include Eclipse SDK jars -->
<path id="classpath">
<pathelement location="${build.classes}"/>
<pathelement location="${hadoop.root}/build/classes"/>
<path refid="eclipse-sdk-jars"/>
<!-- 增加这个fileset配置 -->
<fileset dir="${hadoop.root}">
<include name="*.jar"/>
</fileset>
<!-- end -->
</path>
<!-- Skip building if eclipse.home is unset. -->
<target name="check-contrib" unless="eclipse.home">
<property name="skip.contrib" value="yes"/>
<echo message="eclipse.home unset: skipping eclipse plugin"/>
</target>
<target name="compile">
<echo message="contrib: ${name}"/>
<!--
如下的encoding配置非常关键!
-->
<javac
encoding="ISO-8859-1"
srcdir="${src.dir}"
includes="**/*.java"
destdir="${build.classes}"
debug="on"
deprecation="off">
<classpath refid="classpath"/>
</javac>
</target>
<!-- Override jar target to specify manifest -->
<target name="jar" depends="compile" unless="skip.contrib">
<mkdir dir="${build.dir}/lib"/>
<copy file="${hadoop.root}/hadoop-core-${version}.jar" tofile="${build.dir}/lib/hadoop-core.jar" verbose="true"/>
<!-- 增加如下6个copy配置 -->
<copy file="${hadoop.root}/lib/commons-cli-1.2.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/commons-configuration-1.6.jar" todir="${build.dir}/lib" verbose="true" />
<copy file="${hadoop.root}/lib/commons-httpclient-3.0.1.jar" todir="${build.dir}/lib" verbose="true" />
<copy file="${hadoop.root}/lib/jackson-core-asl-1.8.8.jar" todir="${build.dir}/lib" verbose="true" />
<copy file="${hadoop.root}/lib/commons-lang-2.4.jar" todir="${build.dir}/lib" verbose="true" />
<copy file="${hadoop.root}/lib/jackson-mapper-asl-1.8.8.jar" todir="${build.dir}/lib" verbose="true" />
<!-- end -->
<jar
jarfile="${build.dir}/hadoop-${name}-${version}.jar"
manifest="${root}/META-INF/MANIFEST.MF">
<fileset dir="${build.dir}" includes="classes/ lib/"/>
<fileset dir="${root}" includes="resources/ plugin.xml"/>
</jar>
</target>
</project>
Note: 其实完全可以剪切这段代码使用,注意修改您机器上的hadoop源码目录路径和eclipse安装路径!
2. MANIFEST.MF修改为:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MapReduce Tools for Eclipse
Bundle-SymbolicName: org.apache.hadoop.eclipse;singleton:=true
Bundle-Version: 0.18
Bundle-Activator: org.apache.hadoop.eclipse.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.jdt.launching,
org.eclipse.debug.core,
org.eclipse.jdt,
org.eclipse.jdt.core,
org.eclipse.core.resources,
org.eclipse.ui.ide,
org.eclipse.jdt.ui,
org.eclipse.debug.ui,
org.eclipse.jdt.debug.ui,
org.eclipse.core.expressions,
org.eclipse.ui.cheatsheets,
org.eclipse.ui.console,
org.eclipse.ui.navigator,
org.eclipse.core.filesystem,
org.apache.commons.logging
Eclipse-LazyStart: true
Bundle-ClassPath: classes/,lib/hadoop-core.jar,lib/jackson-core-asl-1.8.8.jar,lib/jackson-mapper-asl-1.8.8.jar,lib/commons-configuration-1.6.jar,lib/commons-lang-2.4.jar,lib/commons-httpclient-3.0.1.jar,lib/commons-cli-1.2.jar
Bundle-Vendor: Apache Hadoop
3. 在hadoop源码目录下新建build/contrib/eclipse-plugin/classes目录。
在${hadoop源码目录}/src/contrib/eclipse-plugin目录下执行:ant,开始编译插件。
编译完成之后,在${hadoop源码目录}/build/contrib/eclipse-plugin/下面会生成hadoop-eclipse-plugin-1.2.1.jar文件,复制到eclipse的plugin目录下即可。
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
应用环境
Hadoop: apache hadoop1.2.1
Eclipse Version: Kepler Service Release 1
计划在Eclipse中直接运行一些MapReduce测试程序,在 google code上下载了插件:hadoop-0.20.1-eclipse-plugin.jar,但是在配置hadoop location时却报错:
Call to localhost/127.0.0.1:9000 failed on local exception: java.io.EOFException,如图所示:
原因:Hadoop服务端版本和eclipse插件版本不一致。
解决方案:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
所以就重新编译了一个hadoop 1.2.1 eclipse plugin,编译过程如下:
1. 插件源代码在${hadoop源码目录}/src/contrib/eclipse-plugin下面,需要修改build.xml文件如下:
(Note:需要修改的地方已经用蓝色字体进行了标注,其他保持原本默认配置即可
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project default="jar" name="eclipse-plugin">
<!-- 增加如下这8个property配置 -->
<property name="name" value="${ant.project.name}" />
<property name="root" value="${basedir}" />
<property name="hadoop.root" location="haoop源码目录" />
<property name="version" value="1.2.1" />
<property name="eclipse.home" location="eclipse安装位置"/>
<property name="build.dir" location="${hadoop.root}/build/contrib/${name}"/>
<property name="build.classes" location="${build.dir}/classes"/>
<property name="src.dir" location="${root}/src/java"/>
<!-- end -->
<!-- 注释掉这个import语句 -->
<!--<import file="../build-contrib.xml"/>-->
<path id="eclipse-sdk-jars">
<fileset dir="${eclipse.home}/plugins/">
<include name="org.eclipse.ui*.jar"/>
<include name="org.eclipse.jdt*.jar"/>
<include name="org.eclipse.core*.jar"/>
<include name="org.eclipse.equinox*.jar"/>
<include name="org.eclipse.debug*.jar"/>
<include name="org.eclipse.osgi*.jar"/>
<include name="org.eclipse.swt*.jar"/>
<include name="org.eclipse.jface*.jar"/>
<include name="org.eclipse.team.cvs.ssh2*.jar"/>
<include name="com.jcraft.jsch*.jar"/>
</fileset>
</path>
<!-- Override classpath to include Eclipse SDK jars -->
<path id="classpath">
<pathelement location="${build.classes}"/>
<pathelement location="${hadoop.root}/build/classes"/>
<path refid="eclipse-sdk-jars"/>
<!-- 增加这个fileset配置 -->
<fileset dir="${hadoop.root}">
<include name="*.jar"/>
</fileset>
<!-- end -->
</path>
<!-- Skip building if eclipse.home is unset. -->
<target name="check-contrib" unless="eclipse.home">
<property name="skip.contrib" value="yes"/>
<echo message="eclipse.home unset: skipping eclipse plugin"/>
</target>
<target name="compile">
<echo message="contrib: ${name}"/>
<!--
如下的encoding配置非常关键!
-->
<javac
encoding="ISO-8859-1"
srcdir="${src.dir}"
includes="**/*.java"
destdir="${build.classes}"
debug="on"
deprecation="off">
<classpath refid="classpath"/>
</javac>
</target>
<!-- Override jar target to specify manifest -->
<target name="jar" depends="compile" unless="skip.contrib">
<mkdir dir="${build.dir}/lib"/>
<copy file="${hadoop.root}/hadoop-core-${version}.jar" tofile="${build.dir}/lib/hadoop-core.jar" verbose="true"/>
<!-- 增加如下6个copy配置 -->
<copy file="${hadoop.root}/lib/commons-cli-1.2.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/commons-configuration-1.6.jar" todir="${build.dir}/lib" verbose="true" />
<copy file="${hadoop.root}/lib/commons-httpclient-3.0.1.jar" todir="${build.dir}/lib" verbose="true" />
<copy file="${hadoop.root}/lib/jackson-core-asl-1.8.8.jar" todir="${build.dir}/lib" verbose="true" />
<copy file="${hadoop.root}/lib/commons-lang-2.4.jar" todir="${build.dir}/lib" verbose="true" />
<copy file="${hadoop.root}/lib/jackson-mapper-asl-1.8.8.jar" todir="${build.dir}/lib" verbose="true" />
<!-- end -->
<jar
jarfile="${build.dir}/hadoop-${name}-${version}.jar"
manifest="${root}/META-INF/MANIFEST.MF">
<fileset dir="${build.dir}" includes="classes/ lib/"/>
<fileset dir="${root}" includes="resources/ plugin.xml"/>
</jar>
</target>
</project>
Note: 其实完全可以剪切这段代码使用,注意修改您机器上的hadoop源码目录路径和eclipse安装路径!
2. MANIFEST.MF修改为:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MapReduce Tools for Eclipse
Bundle-SymbolicName: org.apache.hadoop.eclipse;singleton:=true
Bundle-Version: 0.18
Bundle-Activator: org.apache.hadoop.eclipse.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.jdt.launching,
org.eclipse.debug.core,
org.eclipse.jdt,
org.eclipse.jdt.core,
org.eclipse.core.resources,
org.eclipse.ui.ide,
org.eclipse.jdt.ui,
org.eclipse.debug.ui,
org.eclipse.jdt.debug.ui,
org.eclipse.core.expressions,
org.eclipse.ui.cheatsheets,
org.eclipse.ui.console,
org.eclipse.ui.navigator,
org.eclipse.core.filesystem,
org.apache.commons.logging
Eclipse-LazyStart: true
Bundle-ClassPath: classes/,lib/hadoop-core.jar,lib/jackson-core-asl-1.8.8.jar,lib/jackson-mapper-asl-1.8.8.jar,lib/commons-configuration-1.6.jar,lib/commons-lang-2.4.jar,lib/commons-httpclient-3.0.1.jar,lib/commons-cli-1.2.jar
Bundle-Vendor: Apache Hadoop
3. 在hadoop源码目录下新建build/contrib/eclipse-plugin/classes目录。
在${hadoop源码目录}/src/contrib/eclipse-plugin目录下执行:ant,开始编译插件。
编译完成之后,在${hadoop源码目录}/build/contrib/eclipse-plugin/下面会生成hadoop-eclipse-plugin-1.2.1.jar文件,复制到eclipse的plugin目录下即可。
相关文章推荐
- Eclipse快捷键 10个最有用的快捷键
- 在任意bean中获取spring上下文集合
- 47 java final 关键字
- 计算Java程序运行所需要的时间
- Java CMD 命令设置系统环境变量(windows)
- Eclipse快捷键大全
- Struts2 第二篇 Action名称的搜索路径
- java中创建图片的缩略图
- java中Jbutton常用设置
- Spring读取Properties配置文件
- 常见汉字Unicode编码
- Java 动态代理机制分析及扩展,第 2 部分
- 46 java 单例类(singleton)
- springmvc上传文件
- java小笔记----awt 使用自定义字体
- java.util.concurrent线程池
- 《Beginning Java 7》 - 9 - Nested Types 嵌套类型
- 45 java static 关键字
- java代码------------条件运算符 ?:
- java代码-----------逻辑运算符、 &&逻辑与 ||或