2014-01-31 215 views
0

我有一個MapReduce的應用程序,需要一個HBase的源數據,並將其mapreduces另一個HBase的表,全部寫在Java.When我使用空指針異常

hadoop jar myhbase.jar 

它終止了與一個NullpointerException 運行如下圖所示:


14/01/31 11:07:02 INFO zookeeper.ClientCnxn: Socket connection established to 127.0.0.1/127.0.0.1:2181, initiating session 
14/01/31 11:07:02 INFO zookeeper.ClientCnxn: Session establishment complete on server 127.0.0.1/127.0.0.1:2181, sessionid = 0x143e677d6e30007, negotiated timeout = 180000 
14/01/31 11:07:03 INFO mapreduce.TableOutputFormat: Created table instance for hourinfo 
14/01/31 11:07:03 INFO mapred.JobClient: Cleaning up the staging area hdfs://192.168.1.149:9000/hadoop_tmp/mapred/staging/root/.staging/job_201401310933_0002 
Exception in thread "main" java.lang.NullPointerException 
     at org.apache.hadoop.net.DNS.reverseDns(DNS.java:72) 
     at org.apache.hadoop.hbase.mapreduce.TableInputFormatBase.reverseDNS(TableInputFormatBase.java:219) 
     at org.apache.hadoop.hbase.mapreduce.TableInputFormatBase.getSplits(TableInputFormatBase.java:184) 
     at org.apache.hadoop.mapred.JobClient.writeNewSplits(JobClient.java:962) 
     at org.apache.hadoop.mapred.JobClient.writeSplits(JobClient.java:979) 
     at org.apache.hadoop.mapred.JobClient.access$600(JobClient.java:174) 
     at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:897) 
     at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:850) 
     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:1121) 
     at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:850) 
     at org.apache.hadoop.mapreduce.Job.submit(Job.java:500) 
     at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:530) 
     at mapreduce.hi.api.hbase.HBaseJobRunner.main(HBaseJobRunner.java:37) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
     at java.lang.reflect.Method.invoke(Method.java:597) 
     at org.apache.hadoop.util.RunJar.main(RunJar.java:156) 

我使用hbase-0.94.5hadoop-1.0.4。我真的被困在此error.Please幫助..

回答

-1

好的,我解決了這個問題。從異常我得到它起源於TableInputFormatBase.getSplits()。當我分析TableInputFormatBase的源代碼時,它正在尋找作業配置參數hbase.nameserver.address。當我從我的代碼中設置這個值時,它工作。

+0

設置該屬性不是必需的,您的反向DNS不起作用。 – pferrel

1

退房您的堆棧跟蹤的頂部:

at org.apache.hadoop.net.DNS.reverseDns(DNS.java:72) 

確保您的正向和反向DNS查找完全匹配您的HBase/ZK節點。

+0

我該如何驗證這一點。請幫忙 –

+0

不需要。我錯過了一個設置作業配置的屬性。感謝您的意見。 –

+0

@jtravaglini是正確的,但有關如何診斷和解決問題的更多信息會很好。 – pferrel