51

I am new in HIVE. I have already set up hadoop and it works well, and I want to set up Hive. When I start hive , it shows an error as

Caused by: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D

Are there any solutions?

Nishu Tayal
  • 20,106
  • 8
  • 49
  • 101
Exia
  • 2,381
  • 4
  • 17
  • 24

7 Answers7

150

Put the following at the beginning of hive-site.xml

  <property>
    <name>system:java.io.tmpdir</name>
    <value>/tmp/hive/java</value>
  </property>
  <property>
    <name>system:user.name</name>
    <value>${user.name}</value>
  </property>

See also question

Community
  • 1
  • 1
Jonathan L
  • 9,552
  • 4
  • 49
  • 38
  • 22
    THIS SHOULD BE MARKED AS THE ANSWER. – orim May 30 '17 at 10:51
  • This is the solution. @Exia this should be marked as the answer. – Ayush Vatsyayan Jul 26 '17 at 04:43
  • @Igor - if I remembered correctly, I checked the log file at that time, and found that these two property values are expected to be defined when starting HIVE – Jonathan L Feb 19 '21 at 07:01
  • @JonathanL,still returns error :java.lang.RuntimeException: Couldn't create directory /tmp/hive/java/1eb3bb53-f740-4753-996b-b53483ffa531_resources – Venus Jul 06 '21 at 07:51
  • Please note that these property elements should be inside of ``, not exactly at the beginning of the `hive-site.xml` file. – Ashim Jan 02 '23 at 02:55
18

Change in hfs-site.xml this properties

<name>hive.exec.scratchdir</name>
<value>/tmp/hive-${user.name}</value>

 <name>hive.exec.local.scratchdir</name>
 <value>/tmp/${user.name}</value>

<name>hive.downloaded.resources.dir</name>
<value>/tmp/${user.name}_resources</value>

<name>hive.scratch.dir.permission</name>
    <value>733</value>

restart hive metastore and hiveserver2

  • ${user.name} is definitely the best right answer. Makes you wonder why the hive devs broke the ${system:user.name} syntax. – Chris Jun 16 '16 at 21:55
  • I did the above changes in hive-site.xml (on mac). Thanks :) – gnsb Nov 22 '16 at 05:43
16

I figure it out myself. In the hive-site.xml, replace ${system:java.io.tmpdir}/${system:user.name} by /tmp/mydir as what has been told in https://cwiki.apache.org/confluence/display/Hive/AdminManual+Configuration.

Exia
  • 2,381
  • 4
  • 17
  • 24
5

Exception in thread "main" java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D system:java.io.tmpdir - path
system:user.name - username

Above properties are system level properties which need to set by user, So hive site template didn't provide these, required manual configuration.

Set the above properties like using property tag with name value key pair in hive-site.xml, Its upto user level to choose the location of temp

<property>
    <name>system:java.io.tmpdir</name>
    <value>/user/local/hive/tmp/java</value>
  </property>
  <property>
    <name>system:user.name</name>
    <value>${user.name}</value>
  </property>
Kanthishere
  • 173
  • 3
  • 7
0

add property in hive-site.xml

<configuration>
<property>
  <name>hive.metastore.schema.verification</name>
  <value>false</value>
  <description>Will remove your error occurring because of metastore_db in shark</description>
</property>
</configuration>

add java and hadoop path in hive-env.sh according to your system.

# Set HADOOP_HOME to point to a specific hadoop install directory
export HADOOP_HOME=/home/user17/BigData/hadoop

#hive 
export HIVE_HOME=/home/user17/BigData/hive

# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=$HIVE_HOME/conf

and also set hive and hadoop path in .bashrc

export JAVA_HOME=/home/user17/jdk
export PATH=$PATH:$JAVA_HOME/bin

export HADOOP_INSTALL=/home/user17/BigData/hadoop
export PATH=$PATH:$HADOOP_INSTALL/bin
export HADOOP_MAPRED_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_HOME=$HADOOP_INSTALL
export HADOOP_HDFS_HOME=$HADOOP_INSTALL
export YARN_HOME=$HADOOP_INSTALL

export HIVE_INSTALL=/home/user17/BigData/hive
export PATH=$PATH:$HIVE_INSTALL/bin

Note-- this all files path are set according to my system , you should give path according to your system. let me know if not work

Kishore
  • 5,761
  • 5
  • 28
  • 53
0

I too have encountered the same error while starting HMaster for Hbase. this was corrected by specfying the path to directory on hdfs where you want to store hbase data in hbase.rootdir property of hbase-site.xml earlier i was using only relative path.

path causing exception : hdfs://localhost:8020

correct path : hdfs://localhost:8020/hbase

Azam Khan
  • 516
  • 5
  • 12
0

Update the local: /tmp absolute temporary path too in hive-site.xml as it's not picking automatically, so I've added manually for property: (hive.exec.local.scratchdir and hive.downloaded.resources.dir)

<property>
    <name>hive.exec.local.scratchdir</name>
    <value>/tmp/${user.name}</value>
    <description>Local scratch space for Hive jobs</description>
  </property>

  <property>
    <name>hive.downloaded.resources.dir</name>
    <value>/tmp/${hive.session.id}_resources</value>
    <description>Temporary local directory for added resources in the remote file system.</description>
  </property>

now it's working....

Rajesh
  • 562
  • 1
  • 10
  • 26