Hadoop mapreduce java NullPoint Exception

0 votes

This is the code where I am getting error:

while (it.hasNext()) {
       elementCount = elementCount+1;
       if(first)
       {
           lattitude = Double.toString((inst.decode(it.toString()))[0]);
           longitude = Double.toString((inst.decode(it.toString()))[1]);
           first = false;

       }

This is the error:

 java.lang.NullPointerException
    at util.hashing.Geohash.decode(Geohash.java:41)
    at org.myorg.LatLong$Reduce.reduce(LatLong.java:67)
    at org.myorg.LatLong$Reduce.reduce(LatLong.java:1)
    at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:176)
    at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:663)
    at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:426)
    at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:396)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1132)
    at org.apache.hadoop.mapred.Child.main(Child.java:249)
Dec 14, 2018 in Big Data Hadoop by digger
• 26,740 points
897 views

1 answer to this question.

0 votes

Try this:

String cords = it.next().toString();
lattitude = Double.toString((inst.decode(cords))[0]);
longitude = Double.toString((inst.decode(cords))[1]);

Instead of this:

lattitude = Double.toString((inst.decode(it.toString()))[0]);
longitude = Double.toString((inst.decode(it.toString()))[1]);
answered Dec 14, 2018 by Omkar
• 69,220 points

Related Questions In Big Data Hadoop

+1 vote
2 answers

Hadoop: Error: Exception in thread “main” java.lang.UnsupportedClassVersionError: a

The reason for this error is because ...READ MORE

answered Aug 6, 2019 in Big Data Hadoop by Venkita
• 240 points
1,896 views
+1 vote
0 answers

Hadoop Mapreduce : Null Pointer Exception

While running the below program, I got ...READ MORE

Dec 6, 2019 in Big Data Hadoop by Tarun
• 160 points
1,625 views
0 votes
1 answer
+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,072 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 11,380 points
2,571 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,058 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,639 views
0 votes
1 answer

Hadoop Mapreduce: Class Not Found Exception

Try adding this Job job = new Job(conf, ...READ MORE

answered Oct 29, 2018 in Big Data Hadoop by Omkar
• 69,220 points
4,108 views
0 votes
1 answer

PIG - Found interface org.apache.hadoop.mapreduce.JobContext, but class was expected

Yes, it is a compatibility issue. in Hadoop ...READ MORE

answered Oct 10, 2018 in Big Data Hadoop by Omkar
• 69,220 points
1,100 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