分享

hive执行语句时报NullPointerException

howtodown 2014-8-11 16:09:22 发表于 总结型 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 0 32248

问题导读:
hive执行语句时报NullPointerException可能原因是什么,该如何解决?





  1. java.lang.RuntimeException: Error in configuring object
  2.         at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:93)
  3.         at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:64)
  4.         at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
  5.         at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:432)
  6.         at org.apache.hadoop.mapred.MapTask.run(MapTask.java:372)
  7.         at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
  8.         at java.security.AccessController.doPrivileged(Native Method)
  9.         at javax.security.auth.Subject.doAs(Subject.java:415)
  10.         at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121)
  11.         at org.apache.hadoop.mapred.Child.main(Child.java:249)
  12. Caused by: java.lang.reflect.InvocationTargetException
  13.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  14.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  15.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  16.         at java.lang.reflect.Method.invoke(Method.java:601)
  17.         at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:88)
  18.         ... 9 more
  19. Caused by: java.lang.RuntimeException: Error in configuring object
  20.         at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:93)
  21.         at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:64)
  22.         at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
  23.         at org.apache.hadoop.mapred.MapRunner.configure(MapRunner.java:34)
  24.         ... 14 more
  25. Caused by: java.lang.reflect.InvocationTargetException
  26.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  27.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  28.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  29.         at java.lang.reflect.Method.invoke(Method.java:601)
  30.         at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:88)
  31.         ... 17 more
  32. Caused by: java.lang.RuntimeException: Map operator initialization failed
  33.         at org.apache.hadoop.hive.ql.exec.ExecMapper.configure(ExecMapper.java:121)
  34.         ... 22 more
  35. Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.NullPointerException
  36.         at org.apache.hadoop.hive.ql.exec.FileSinkOperator.initializeOp(FileSinkOperator.java:373)
  37.         at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:360)
  38.         at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:436)
  39.         at org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:392)
  40.         at org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:62)
  41.         at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:360)
  42.         at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:436)
  43.         at org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:392)
  44.         at org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:62)
  45.         at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:360)
  46.         at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:436)
  47.         at org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:392)
  48.         at org.apache.hadoop.hive.ql.exec.FilterOperator.initializeOp(FilterOperator.java:78)
  49.         at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:360)
  50.         at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:436)
  51.         at org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:392)
  52.         at org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:166)
  53.         at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:360)
  54.         at org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:441)
  55.         at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:360)
  56.         at org.apache.hadoop.hive.ql.exec.ExecMapper.configure(ExecMapper.java:98)
  57.         ... 22 more
  58. Caused by: java.lang.NullPointerException
  59.         at org.apache.hadoop.hive.ql.exec.FileSinkOperator.initializeOp(FileSinkOperator.java:315)
  60.         ... 42 more
复制代码

此语句此前执行通过。开始怀疑是否hive表的原始数据格式有问题?后面排除。 经过检查,原来是环境变量设置的问题。
在hive-env.sh中添加

  1. [hbase@h46 hive-0.10.0]$ vi conf/hive-env.sh
  2. export HIVE_CONF_DIR=$HIVE_HOME/conf
  3. export HIVE_AUX_JARS_PATH=$HIVE_HOME/lib
复制代码
或者在.bashrc中添加:
export HIVE_CONF_DIR=$HIVE_HOME/conf
export HIVE_AUX_JARS_PATH=$HIVE_HOME/lib

引起问题是原因是我在.bashrc中将HIVE_AUX_JARS_PATH指到另一个目录去了。

也可以在启动hive CLI时,指定相关库。
$HIVE_HOME/bin/hive –auxpath $HIVE_HOME/lib/hive-hbase-handler-0.10.0.jar,$HIVE_HOME/lib/hbase-0.94.3.jar,$HIVE_HOME/lib/zookeeper-3.3.4.jar,$HIVE_HOME/lib/guava-r09.jar -hiveconf hbase.master=com.abloz:60000

或者在hive-site.xml中配置:


  1. <property>
  2. <name>hive.zookeeper.quorum</name>
  3. <value>h1,h2,h3</value>
  4. <description>The list of zookeeper servers to talk to. This is only needed for read/write locks.</description>
  5. </property>
  6. <property>
  7. <name>hive.aux.jars.path</name>
  8. <value>file:///home/aaa/hive-0.10.0/lib/hive-hbase-handler-0.10.0.jar,file:///home/aaa/hive-0.10.0/lib/hbase-0.94.3.jar,file:///home/aaa/hive-0.10.0/lib/zookeeper-3.4.3.jar</value>
  9. </property>
复制代码









没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条