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,590 points
26 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,140 points

Related Questions In Big Data Hadoop

0 votes
1 answer
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,630 points
409 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 in Big Data Hadoop by Gitika
• 8,380 points
2,466 views
0 votes
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
• 9,070 points
1,679 views
0 votes
10 answers

hadoop fs -put command?

copy command can be used to copy files ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Sujay
8,164 views
0 votes
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,260 points
573 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,140 points
31 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,140 points
95 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.