Exia
Exia

Reputation: 2551

java.net.URISyntaxException when starting HIVE

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?

Upvotes: 52

Views: 52586

Answers (7)

Rajesh
Rajesh

Reputation: 692

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....

Upvotes: 0

Kanthishere
Kanthishere

Reputation: 169

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>

Upvotes: 5

Jonathan L
Jonathan L

Reputation: 10648

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

Upvotes: 152

Azam Khan
Azam Khan

Reputation: 539

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

Upvotes: 0

Barbaros Yıldız
Barbaros Yıldız

Reputation: 305

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

Upvotes: 18

Exia
Exia

Reputation: 2551

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.

Upvotes: 16

Kishore
Kishore

Reputation: 5881

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

Upvotes: 0

Related Questions