submitJob method in JobClient of Hadoop throws null pointer

0 votes

I am tryng to execute a MapReduce job and I want to periodically poll its status. I am trying to use the submitJob(jobConf) method of Jobclient class in the code as follows

 JobConf conf = new JobConf(SampleJobClass.class)   
 JobClient j= new JobClient();
 j.setConf(conf);
 System.out.println("from conf" +j.getConf().toString());
 RunningJob submitJob=j.submitJob(conf);`

I keep getting a null pointer error at the line j.submitJob(conf) The error stack is :

Exception in thread "main" java.lang.NullPointerException
    at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:844)
    at org.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:818)

Can someone tell me how to solve this error?

Sep 18, 2018 in Big Data Hadoop by Frankie
• 9,810 points
140 views

1 answer to this question.

0 votes

I had this problem as well. But when i use j.runJob(conf); it works well. You can use the static function JobClient.runJob(conf); This is what i tried and it works

public static RunningJob runJob(JobConf job) throws IOException {
JobClient jc = new JobClient(job);
RunningJob rj = jc.submitJob(job);
try {
  if (!jc.monitorAndPrintJob(job, rj)) {
    throw new IOException("Job failed!");
  }
} catch (InterruptedException ie) {
  Thread.currentThread().interrupt();
}
return rj;

} So I use the submitJob funciton in this way:

JobClient jcli = new JobClient(jconf);
        RunningJob rJob = jcli.submitJob(jconf);
        while (true){
            Thread.sleep(5000);
            System.out.println(rJob);
            if (rJob.isComplete())
                break;
        }
answered Sep 18, 2018 by Neha
• 6,300 points

Related Questions In Big Data Hadoop

0 votes
1 answer

Method to schedule the number of Mappers and Reducers in a Hadoop MapReduce Tsk.

The number of Mapper tasks for a ...READ MORE

answered Apr 25, 2019 in Big Data Hadoop by ravikiran
• 4,600 points
127 views
0 votes
1 answer

What is the use of sequence file in Hadoop?

Sequence files are binary files containing serialized ...READ MORE

answered Apr 5, 2018 in Big Data Hadoop by Ashish
• 2,650 points
4,269 views
0 votes
12 answers

What is Zookeeper? What is the purpose of Zookeeper in Hadoop Ecosystem?

Hey, Apache Zookeeper says that it is a ...READ MORE

answered Apr 29, 2019 in Big Data Hadoop by Gitika
• 36,930 points
11,858 views
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,950 points
5,854 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyF ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
36,833 views
–1 vote
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,320 points
2,192 views
0 votes
1 answer
0 votes
1 answer

How to create a project for the first time in Hadoop.?

If you want to learn Hadoop framework ...READ MORE

answered Jul 26, 2018 in Big Data Hadoop by Neha
• 6,300 points
244 views
0 votes
1 answer

What are the different ways of Installing Hadoop into our local machine?

Hadoop runs on Unix and on Windows. ...READ MORE

answered Aug 3, 2018 in Big Data Hadoop by Neha
• 6,300 points
1,553 views