安装Hive过程中,出现Exception in thread "main" java.lang.IllegalArgumentException: java.net.URISyntaxExcepti

一,在安装hive过程中,输入hive命令,出现了如下错误:

Exception in thread "main" 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:254)
    at org.apache.hadoop.fs.Path.(Path.java:212)
    at org.apache.hadoop.hive.ql.session.SessionState.createSessionDirs(SessionState.java:644)
    at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:563)
    at org.apache.hadoop.hive.ql.session.SessionState.beginStart(SessionState.java:531)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:705)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:641)
    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:234)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:148)
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.(URI.java:745)
    at org.apache.hadoop.fs.Path.initialize(Path.java:251)
    ... 12 more

二,出现的原因:
1,hive-site.xml里的临时目录没有设置好,一共有三个:

<property>
    <name>Hive.exec.local.scratchdirname>
    ${system:Java.io.tmpdir}/${system:user.name}
    Local scratch space for Hive jobs
  property>

  <property>
    <name>hive.downloaded.resources.dirname>
    ${system:java.io.tmpdir}/${hive.session.id}_resources
    Temporary local directory for added resources in the remote file system.
  property>

<property>
    <name>hive.server2.logging.operation.log.locationname>
    /home/lch/software/Hive/apache-hive-2.1.1-bin/tmp/${system:user.name}/operation_logs
    Top level directory where operation logs are stored if logging functionality is enabled
  property>

三,解决的方法:

1,将hive-site.xml文件中的${system:java.io.tmpdir}替换为hive的临时目录,例如我替换为/home/lch/software/Hive/apache-hive-2.1.1-bin/tmp/,该目录(tmp)如果不存在则要自己手工创建,并且赋予读写权限。

2, 具体修改如下:

<property>
    <name>Hive.exec.local.scratchdirname>
    <value>/home/lch/software/Hive/apache-hive-2.1.1-bin/tmp//${system:user.name}value>
    <description>Local scratch space for Hive jobsdescription>
  property>

  <property>
    <name>hive.downloaded.resources.dirname>
    <value>/home/lch/software/Hive/apache-hive-2.1.1-bin/tmp/${hive.session.id}_resourcesvalue>
    <description>Temporary local directory for added resources in the remote file system.description>
  property>

<property>
    <name>hive.server2.logging.operation.log.locationname>
    <value>/home/lch/software/Hive/apache-hive-2.1.1-bin/tmp/root/operation_logsvalue>
    <description>Top level directory where operation logs are stored if logging functionality is enableddescription>
  property>

问题就解决了.

你可能感兴趣的:(大数据,hive)