安装Hive过程中,出现Exception in thread "main" java.lang.IllegalArgumentException: java.net.URISyntaxExceptiion: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D
为hive-site.xml有三处地方未配置好。或者原配置没有目录。配置一些临时文件目录。
报错信息如下:
Logging initialized using configuration in jar:file:/usr/local/hive/lib/hive-common-1.2.1.jar!/hive-log4j.properties
Exception in thread "main" java.lang.RuntimeException: java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D
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:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:226)
at org.apache.hadoop.util.RunJar.main(RunJar.java:141)
Caused by: java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D
at org.apache.hadoop.fs.Path.initialize(Path.java:205)
at org.apache.hadoop.fs.Path.<init>(Path.java:171)
at org.apache.hadoop.hive.ql.session.SessionState.createSessionDirs(SessionState.java:563)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:508)
... 8 more
Caused by: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D
at java.net.URI.checkPath(URI.java:1823)
at java.net.URI.<init>(URI.java:745)
at org.apache.hadoop.fs.Path.initialize(Path.java:202)
... 11 more
打开hive配置。路径 hive下的conf的hive-site.xml。
[root@master conf]# vim hive-site.xml
[root@master conf]# pwd
/usr/local/hive/conf
第一处
<property>
<name>hive.exec.local.scratchdir</name>
<value>/tmp</value>
<description>Local scratch space for Hive jobs</description>
</property>
第二处
<property>
<name>hive.downloaded.resources.dir</name>
<value>/tmp</value>
<description>Temporary local directory for added resources in the remote file system.</description>
</property>
第三处
<property>
<name>hive.server2.logging.operation.log.location</name>
<value>/tmp/operation_logs</value>
<description>Top level directory where operation logs are stored if logging functionality is enabled</description>
</property>
有问题的地方是与/tmp不一样的地址。
这样就成功了。其他网友也有其他的解决方案。
需要知道现在的hadoop中的HDFS存了什么
[root@master conf]# hadoop fs -lsr /
进入hive并创建一个测试库和测试表
[root@master conf]# hive
hive> create database test_hive;
OK
Time taken: 0.19 seconds
hive> show databases;
OK
default
test_hive
Time taken: 0.016 seconds, Fetched: 2 row(s)
创建库成功!
查询一下HDFS有什么变化
[root@slave1 logs]# hadoop fs -lsr /
lsr: DEPRECATED: Please use 'ls -R' instead.