Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Exception in thread "main" java.lang.RuntimeException: core-site.xml not found

Solved Go to solution
Highlighted

Exception in thread "main" java.lang.RuntimeException: core-site.xml not found

New Contributor

I tried to set the permission for hive by using the following command :

# hdfs dfs -chmod 777/

But however I got the following error :

Exception in thread "main" java.lang.RuntimeException: core-site.xml not found                                                                       
        at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2640)                                                                
        at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2566)                                                               
        at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:2451)                                                                    
        at org.apache.hadoop.conf.Configuration.set(Configuration.java:1164)                                                                         
        at org.apache.hadoop.conf.Configuration.set(Configuration.java:1136)                                                                         
        at org.apache.hadoop.conf.Configuration.setBoolean(Configuration.java:1472)                                                                  
        at org.apache.hadoop.util.GenericOptionsParser.processGeneralOptions(GenericOptionsParser.java:321)                                          
        at org.apache.hadoop.util.GenericOptionsParser.parseGeneralOptions(GenericOptionsParser.java:487)                                            
        at org.apache.hadoop.util.GenericOptionsParser.<init>(GenericOptionsParser.java:170)                                                         
        at org.apache.hadoop.util.GenericOptionsParser.<init>(GenericOptionsParser.java:153)                                                         
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)                                                                                 
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:90)                                                                                 
        at org.apache.hadoop.fs.FsShell.main(FsShell.java:356)   

I got this same error when I typed the following commands :

sudo -u hdfs hadoop fs -mkdir /user/hive/warehouse
hdfs dfs -ls

But I am unable to figure out a solution. Can someone please help me out ?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Exception in thread "main" java.lang.RuntimeException: core-site.xml not found

Super Mentor

@Amogh Suman

Exception in thread "main" java.lang.RuntimeException: core-site.xml not found                                                                                  	at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2640)                                                                

The above error indicates that the machine where you are running this "hadoop" command does not have the Hadoop Conf directory set correctly so it is not able to find the core-site.xml.

.

In HDP cluster we see the default hadoop conf directory points to the following directory

[root@sandbox ~]# ls -l /etc/hadoop/conf/

[root@sandbox ~]# ls -l /etc/hadoop/conf/   | grep site.xml
-rw-r--r-- 1 hdfs   hadoop  4089 May 13  2017 core-site.xml
-rw-r--r-- 1 hdfs   hadoop  6820 May 13  2017 hdfs-site.xml
-rw-r--r-- 1 root   root     758 Apr  1  2017 mapred-site.xml.template
-rw-r--r-- 1 yarn   hadoop 18956 Aug 21 04:25 yarn-site.xml

.

But in your host you will need to check which directory contains the "core-site.xml" and "hdfs-site.xml" and then set the following property in the terminal to point to that directory. Suppose if the "/PATH/TO/conf" directory contains the hadoop config files then please do this:

# export HADOOP_CONF_DIR=/PATH/TO/conf
# sudo -u hdfs hadoop fs -mkdir /user/hive/warehouse

.

1 REPLY 1

Re: Exception in thread "main" java.lang.RuntimeException: core-site.xml not found

Super Mentor

@Amogh Suman

Exception in thread "main" java.lang.RuntimeException: core-site.xml not found                                                                                  	at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2640)                                                                

The above error indicates that the machine where you are running this "hadoop" command does not have the Hadoop Conf directory set correctly so it is not able to find the core-site.xml.

.

In HDP cluster we see the default hadoop conf directory points to the following directory

[root@sandbox ~]# ls -l /etc/hadoop/conf/

[root@sandbox ~]# ls -l /etc/hadoop/conf/   | grep site.xml
-rw-r--r-- 1 hdfs   hadoop  4089 May 13  2017 core-site.xml
-rw-r--r-- 1 hdfs   hadoop  6820 May 13  2017 hdfs-site.xml
-rw-r--r-- 1 root   root     758 Apr  1  2017 mapred-site.xml.template
-rw-r--r-- 1 yarn   hadoop 18956 Aug 21 04:25 yarn-site.xml

.

But in your host you will need to check which directory contains the "core-site.xml" and "hdfs-site.xml" and then set the following property in the terminal to point to that directory. Suppose if the "/PATH/TO/conf" directory contains the hadoop config files then please do this:

# export HADOOP_CONF_DIR=/PATH/TO/conf
# sudo -u hdfs hadoop fs -mkdir /user/hive/warehouse

.

Don't have an account?
Coming from Hortonworks? Activate your account here