hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emir Ibrahimbegovic (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HADOOP-8778) Null pointer exception when trying to get job name by job id from jobClient
Date Fri, 07 Sep 2012 14:08:07 GMT
Emir Ibrahimbegovic created HADOOP-8778:

             Summary: Null pointer exception when trying to get job name by job id from jobClient
                 Key: HADOOP-8778
                 URL: https://issues.apache.org/jira/browse/HADOOP-8778
             Project: Hadoop Common
          Issue Type: Bug
          Components: conf
    Affects Versions: 0.23.1
            Reporter: Emir Ibrahimbegovic

Consider the following code :

public static void main(String[] args) throws IOException {
        Configuration conf = HBaseConfiguration.create();
        conf.set("hbase.zookeeper.quorum", "zk1.myhost,zk2.myhost,zk3.myhost");
        conf.set("hbase.zookeeper.property.clientPort", "2181");

        InetSocketAddress jobtracker = new InetSocketAddress("jobtracker.mapredhost.myhost",
        JobClient jobClient = new JobClient(jobtracker, 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();

Code above works without errors but if you add this extra line :


This exception occurs :

Exception in thread "main" java.lang.NullPointerException
	at org.apache.hadoop.mapred.JobClient$NetworkedJob.<init>(JobClient.java:226)
	at org.apache.hadoop.mapred.JobClient.getJob(JobClient.java:1080)

Fix is to add set configuration to jobclient again "jobClient.setConf(conf);" even if it was
instantiated using InetSocketAddress and Configuration (see code above).

If you look at line 225 JobClient :

 Configuration conf = JobClient.this.getConf();
      this.completionPollIntervalMillis = conf.getInt(COMPLETION_POLL_INTERVAL_KEY,

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message