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,830 points
783 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,620 points
811 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 6, 2018 in Big Data Hadoop by Ashish
• 2,650 points
9,605 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
• 65,770 points
30,029 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
• 11,380 points
11,076 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
109,071 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,350 points
4,641 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 27, 2018 in Big Data Hadoop by Neha
• 6,300 points
1,186 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 4, 2018 in Big Data Hadoop by Neha
• 6,300 points
5,292 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP