You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Emir Ibrahimbegovic (JIRA)" <ji...@apache.org> on 2012/09/07 16:08:07 UTC

[jira] [Created] (HADOOP-8778) Null pointer exception when trying to get job name by job id from jobClient

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", 8021);
        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();
                System.out.println(jobId);
            }
        }
    }

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

System.out.println(jobClient.getJob(jobId).getJobName());

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,
          DEFAULT_COMPLETION_POLL_INTERVAL); //NPE occurs here!


--
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

[jira] [Commented] (HADOOP-8778) Null pointer exception when trying to get job name by job id from jobClient

Posted by "Harsh J (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-8778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13450697#comment-13450697 ] 

Harsh J commented on HADOOP-8778:
---------------------------------

What version of Hadoop are you running into this error on? It is not 0.23.1 as you have marked here, since http://svn.apache.org/viewvc/hadoop/common/tags/release-0.23.1/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobClient.java?view=markup does not show line 226 as a match with the stack trace.
                
> 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", 8021);
>         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();
>                 System.out.println(jobId);
>             }
>         }
>     }
> Code above works without errors but if you add this extra line :
> System.out.println(jobClient.getJob(jobId).getJobName());
> 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,
>           DEFAULT_COMPLETION_POLL_INTERVAL); //NPE occurs here!

--
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

[jira] [Commented] (HADOOP-8778) Null pointer exception when trying to get job name by job id from jobClient

Posted by "Harsh J (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-8778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13450757#comment-13450757 ] 

Harsh J commented on HADOOP-8778:
---------------------------------

Thanks! This appears to be a CDH-specific error, so can you instead log a JIRA (just dupe this) at https://issues.cloudera.org/browse/DISTRO please? This JIRA is for Apache Hadoop related issues alone, and yours may be 0.23.1-mr1-cdh4.0.0b2 specific.
                
> 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", 8021);
>         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();
>                 System.out.println(jobId);
>             }
>         }
>     }
> Code above works without errors but if you add this extra line :
> System.out.println(jobClient.getJob(jobId).getJobName());
> 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,
>           DEFAULT_COMPLETION_POLL_INTERVAL); //NPE occurs here!

--
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

[jira] [Commented] (HADOOP-8778) Null pointer exception when trying to get job name by job id from jobClient

Posted by "Emir Ibrahimbegovic (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-8778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13450767#comment-13450767 ] 

Emir Ibrahimbegovic commented on HADOOP-8778:
---------------------------------------------

Thank you I filed a ticket in there. 
                
> 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", 8021);
>         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();
>                 System.out.println(jobId);
>             }
>         }
>     }
> Code above works without errors but if you add this extra line :
> System.out.println(jobClient.getJob(jobId).getJobName());
> 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,
>           DEFAULT_COMPLETION_POLL_INTERVAL); //NPE occurs here!

--
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

[jira] [Commented] (HADOOP-8778) Null pointer exception when trying to get job name by job id from jobClient

Posted by "Emir Ibrahimbegovic (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-8778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13450754#comment-13450754 ] 

Emir Ibrahimbegovic commented on HADOOP-8778:
---------------------------------------------

I apologize for the wrong version, This is the correct version <version>0.23.1-mr1-cdh4.0.0b2</version>
                
> 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", 8021);
>         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();
>                 System.out.println(jobId);
>             }
>         }
>     }
> Code above works without errors but if you add this extra line :
> System.out.println(jobClient.getJob(jobId).getJobName());
> 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,
>           DEFAULT_COMPLETION_POLL_INTERVAL); //NPE occurs here!

--
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