本文介绍了Jobtracker API 错误 - 本地异常调用 localhost/127.0.0.1:50030 失败:java.io.EOFException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Java 连接我的 jobtracker.
下面显示的是我正在尝试执行的程序

 public static void main(String args[]) throws IOException {配置 conf = new Configuration();conf.addResource(新路径("/home/user/hadoop-1.0.3/conf/core-site.xml"));conf.addResource(新路径("/home/user/hadoop-1.0.3/conf/hdfs-site.xml"));conf.addResource(新路径("/home/user/hadoop-1.0.3/conf/mapred-site.xml"));InetSocketAddress jobtracker = new InetSocketAddress("localhost", 50030);JobClient jobClient = new JobClient(jobtracker, conf);jobClient.setConf(conf);JobStatus[] 工作 = jobClient.jobsToComplete();for (int i = 0; i 

这是我得到的例外.即使我尝试用 127.0.0.1 替换 localhost 它也不起作用.同样的错误.

 线程main"java.io.IOException 中的异常:本地异常调用 localhost/127.0.0.1:50030 失败:java.io.EOFException在 org.apache.hadoop.ipc.Client.wrapException(Client.java:1107)在 org.apache.hadoop.ipc.Client.call(Client.java:1075)在 org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:225)在 org.apache.hadoop.mapred.$Proxy1.getProtocolVersion(未知来源)在 org.apache.hadoop.ipc.RPC.getProxy(RPC.java:396)在 org.apache.hadoop.ipc.RPC.getProxy(RPC.java:379)在 org.apache.hadoop.mapred.JobClient.createRPCProxy(JobClient.java:480)在 org.apache.hadoop.mapred.JobClient.<init>(JobClient.java:534)在 com.tcs.nextgen.searchablemetadata.executor.factory.JobChecker.main(JobChecker.java:34)引起:java.io.EOFException在 java.io.DataInputStream.readInt(DataInputStream.java:375)在 org.apache.hadoop.ipc.Client$Connection.receiveResponse(Client.java:811)在 org.apache.hadoop.ipc.Client$Connection.run(Client.java:749)

我添加了所有与 hadoop 相关的 jar.我不明白为什么/"在 localhost/127.0.0.1:50030 之间出现

解决方案

你有没有试过实际的jobtracker端口号,而不是http端口(50030).

尝试在 mapred.job.tracker 属性下的 $HADOOP_HOME/conf/mapred-site.xml 中列出的端口号.这是我的伪 mapred-site.xml conf

<name>mapred.job.tracker</name><值>localhost:9001</值></属性>

如果您查看 JobTracker.getAddress(Configuration) 方法,如果您没有明确指定 jobtracker 主机/端口,您可以看到它使用此属性:

public static InetSocketAddress getAddress(Configuration conf) {字符串 jobTrackerStr =conf.get("mapred.job.tracker", "localhost:8012");返回 NetUtils.createSocketAddr(jobTrackerStr);}

I m trying to connect my jobtracker using Java.
The below shown is the program I am trying to execute

                   public static void main(String args[]) throws IOException {

            Configuration conf = new Configuration();
            conf.addResource(new Path(
                    "/home/user/hadoop-1.0.3/conf/core-site.xml"));
            conf.addResource(new Path(
                    "/home/user/hadoop-1.0.3/conf/hdfs-site.xml"));
            conf.addResource(new Path(
                    "/home/user/hadoop-1.0.3/conf/mapred-site.xml"));


            InetSocketAddress jobtracker = new InetSocketAddress("localhost", 50030);
            JobClient jobClient = new JobClient(jobtracker, conf);
            jobClient.setConf(conf);
            JobStatus[] jobs = jobClient.jobsToComplete();

            for (int i = 0; i < jobs.length; i++) {
                JobStatus js = jobs[i];
                if (js.getRunState() == JobStatus.RUNNING) {
                    JobID jobId = js.getJobID();
                    System.out.println(jobId);
                }
            }
 Exception in thread "main" java.io.IOException: Call to localhost/127.0.0.1:50030 failed on local exception: java.io.EOFException
        at org.apache.hadoop.ipc.Client.wrapException(Client.java:1107)
        at org.apache.hadoop.ipc.Client.call(Client.java:1075)
        at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:225)
        at org.apache.hadoop.mapred.$Proxy1.getProtocolVersion(Unknown Source)
        at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:396)
        at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:379)
        at org.apache.hadoop.mapred.JobClient.createRPCProxy(JobClient.java:480)
        at org.apache.hadoop.mapred.JobClient.<init>(JobClient.java:534)
        at com.tcs.nextgen.searchablemetadata.executor.factory.JobChecker.main(JobChecker.java:34)
    Caused by: java.io.EOFException
        at java.io.DataInputStream.readInt(DataInputStream.java:375)
        at org.apache.hadoop.ipc.Client$Connection.receiveResponse(Client.java:811)
        at org.apache.hadoop.ipc.Client$Connection.run(Client.java:749)

I added all the jars related to hadoop .I cant understand why "/" is comming in between localhost/127.0.0.1:50030

解决方案

Have you tried the actual jobtracker port number, rather than the http port (50030).

Try the port number listed in your $HADOOP_HOME/conf/mapred-site.xml under the mapred.job.tracker property. Here's my pseudo mapred-site.xml conf

<property>
    <name>mapred.job.tracker</name>
    <value>localhost:9001</value>
</property>

If you look at the JobTracker.getAddress(Configuration) method, you can see it uses this property if you don't explicitly specify the jobtracker host / port:

public static InetSocketAddress getAddress(Configuration conf) {
  String jobTrackerStr =
    conf.get("mapred.job.tracker", "localhost:8012");
  return NetUtils.createSocketAddr(jobTrackerStr);
}

这篇关于Jobtracker API 错误 - 本地异常调用 localhost/127.0.0.1:50030 失败:java.io.EOFException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-20 20:22