Hive启动时报错,报错信息如下:
Logging initialized using configuration in jar:file:/usr/local/opt/hive-0.14.0/lib/hive-common-0.14.0.jar!/hive-log4j.properties
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.conf.Configuration.unset(Ljava/lang/String;)V
at org.apache.hadoop.hive.ql.exec.Utilities.resetUmaskInConf(Utilities.java:3561)
at org.apache.hadoop.hive.ql.exec.Utilities.createDirsWithPermission(Utilities.java:3546)
at org.apache.hadoop.hive.ql.session.SessionState.createRootHDFSDir(SessionState.java:521)
at org.apache.hadoop.hive.ql.session.SessionState.createSessionDirs(SessionState.java:478)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:430)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:672)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:616)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
第一种解决方案:
这个问题是由于hive版本较高,hadoop版本较低,不相匹配造成的,解决方法时降低hive的版本,比如降低到hive-0.9.0。
第二种解决方案:
1、在hive-site.xml中添加如下配置:
<property>
<name>fs.permissions.umask-mode</name>
<value>022</value>
<description> Setting a value for fs.permissions.umask-mode to work around issue in HIVE-6962.
It has no impact in hadoop 1.x line on hdfs operations.
</description>
</property>
2、修改hadoop hdfs tmp文件夹的权限
hadoop fs -chmod -R 777 /tmp
3、将hive-site.xml中所有的配置值含有"system:java.io.tmpdir"的配置项替换为绝对路径
在hive-0.14.0下创建临时文件目录hive_tmp:mkdir hive_tmp
将system开始的路径替换为/usr/local/opt/hive-0.14.0/hive_tmp