Anand Hotti
Anand Hotti

Reputation: 1

java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration while running schematool -dbType mysql -initSchema command

when I run schematool -dbType mysql -initSchema command in command prompt it is throwing below error -

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)

Upvotes: -1

Views: 28

Answers (1)

Michael Bullet
Michael Bullet

Reputation: 1

Check in Classpath that all the necessary JARs are included You can add the path of the Hadoop JARs using the HADOOP_CLASSPATH environment variable:

export HADOOP_CLASSPATH=/path/to/hadoop/conf:/path/to/hadoop/lib/*

Checks that Hadoop is correctly installed and configured on the system

Adds the required JARs manually to the classpath, including the JAR containing the Configuration class:

java -cp /path/to/hadoop/conf:/path/to/hadoop/lib/hadoop-common-*.jar:/path/to/hadoop/lib/hadoop-hdfs-*. jar:/path/to/hadoop/lib/hadoop-mapreduce-*.jar:/path/to/hadoop/lib/hadoop-yarn-*.jar org.apache.hadoop.hive.ql.tools.HiveSchemaTool -dbType mysql -initSchema

Check all dependencies are present and there are no version conflicts

If the problem persists, reinstall Hadoop to ensure that all the necessary files are present and configured correctly.

Upvotes: 0

Related Questions