You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by jdh <ti...@yahoo.com.cn> on 2009/09/18 12:53:22 UTC

about java.lang.NullPointerException

Hi, all !

I am a beginner with hbase. I want to load data from hdfs and insert each
word into a table. I use a map class to do so. here is the map method:
 public void map(LongWritable k,Text v,OutputCollector<Text,LongWritable >
output,Reporter report) throws IOException
                    { String line = v.toString();
                      StringTokenizer tokenizer = new StringTokenizer(line);
                      while (tokenizer.hasMoreTokens()) {
                                     word.set(tokenizer.nextToken());
                                     BatchUpdate bu=new
BatchUpdate(word.getBytes());
                                     
bu.put("count:value",Bytes.toBytes("one"));
                                     table.commit(bu);
                               }

when I ran the job, it threw theses error messages:
09/09/18 18:45:27 INFO mapred.JobClient: Task Id :
attempt_200909181330_0014_m_000000_1, Status : FAILED
java.lang.NullPointerException
	at org.mytablemap.TableMap$MapClass.map(TableMap.java:34)
	at org.mytablemap.TableMap$MapClass.map(TableMap.java:22)
	at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:50)
	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:342)
	at org.apache.hadoop.mapred.Child.main(Child.java:158)

I don't know why. Each parameter in map method is defined. 
I am looking forward to your help.
Thanks.

Yan
 
-- 
View this message in context: http://www.nabble.com/about-java.lang.NullPointerException-tp25506749p25506749.html
Sent from the HBase User mailing list archive at Nabble.com.


Re: about java.lang.NullPointerException

Posted by Erik Holstad <er...@gmail.com>.
Hi Yan!
I see that you are using  0.19 or older version of HBase. Do you have chance
to upgrade to 0.20?
HBase 0.20 is highly recommended with a lot of improvements compared to the
older versions.
If not, maybe you can supply your map code or point to the line where this
exception is thrown?

Regards Erik