解决:Permission denied at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:522)

 2023-02-26    418  

Logging initialized using configuration in jar:file:/opt/hive/1.2.1/lib/hive-common-1.2.1.jar!/hive-log4j.properties
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: java.io.IOException: Permission denied
        at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:522)
        at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:677)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:621)
        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:212)
Caused by: java.lang.RuntimeException: java.io.IOException: Permission denied
        at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:515)
        ... 7 more
Caused by: java.io.IOException: Permission denied
        at java.io.UnixFileSystem.createFileExclusively(Native Method)
        at java.io.File.createNewFile(File.java:1006)
        at java.io.File.createTempFile(File.java:1989)
        at org.apache.hadoop.hive.ql.session.SessionState.createTempFile(SessionState.java:818)
        at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:513)
        ... 7 more
myuser@namenode:/opt/hive/current/bin$

尝试一:

myuser@namenode:~$ sudo hive
sudo: hive: command not found
#必须到执行文件路径,sudo之后还必须指定下环境变量
myuser@namenode:/opt/hive/current/bin$ sudo source /etc/profile ; ./hive

参考
跟在crontab中执行代码情况类似hive: command not found错误解决

尝试二

把hive参数hive.exec.scratchdir 设置的目录,一般为 /tmp/hive权限调整为777即可.即: chmod -R 777 /hive/tmp

解决:Permission denied  at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:522)

<property>
  <name>hive.exec.scratchdir</name>
  <value>/hivetest/hive</value>
  <description>HDFS root scratch dir for Hive jobs which gets created with write all (733) permission. For each connecting user, an HDFS scratch dir: ${hive.exec.scratchdir}/&lt;username&gt; is created, with ${hive.scratch.dir.pe
  rmission}.</description>
</property>

发现已经是了

myuser@namenode:/opt/hive/current/bin$ hdfs dfs -ls  /hivetest/
17/04/26 15:17:09 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 1 items
drwxrwxrwx   - 777 hive          0 2017-01-10 15:44 /hivetest/hive

hive错误:Exception in thread “main” java.lang.RuntimeException: java.io.IOException: Permission denied

尝试三

修改用户组

usermod -a -G hive  myuser
#检查修改
myuser@namenode:/opt/hive/current/bin$ groups
myuser adm cdrom sudo dip plugdev lpadmin sambashare

myuser@namenode:/opt/hive/current/bin$ groups myuser
myuser : myuser adm cdrom sudo dip plugdev lpadmin sambashare hive

还是不行,报原来的错误。

尝试四

切换用户

myuser@namenode:/opt/hive/current/bin$ su hive
#密码:123456
Password:
hive@namenode:/opt/hive/current/bin$

解决

以上所述是小编给大家介绍的解决:Permission denied at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:522),希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对77isp云服务器技术网的支持!

原文链接:https://www.77isp.com/post/34577.html

=========================================

https://www.77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。