I am trying to create a table in Hbase using Java, but I keep getting a ClassNotFoundException.
import .apache.hadoop.hbase.HBaseConfiguration;
import .apache.hadoop.hbase.HColumnDescriptor;
import .apache.hadoop.hbase.HTableDescriptor;
import .apache.hadoop.hbase.TableName;
import .apache.hadoop.hbase.client.*;
import .apache.hadoop.conf.Configuration;
import java.io.IOException;
I've included all of the JAR files from the lib folder of HBase2.6.1-hadoop3 and imported these classes.
public class Upload {
public static void main(String args[]) throws IOException
{
Configuration conf = HBaseConfiguration.create();
When this part of the code runs, I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: /slf4j/LoggerFactory
at .apache.hadoop.conf.Configuration.<clinit>(Configuration.java:230)
at Upload.main(Upload.java:15)
Caused by: java.lang.ClassNotFoundException: .slf4j.LoggerFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 2 more
Is there any way to fix this?
I am trying to create a table in Hbase using Java, but I keep getting a ClassNotFoundException.
import .apache.hadoop.hbase.HBaseConfiguration;
import .apache.hadoop.hbase.HColumnDescriptor;
import .apache.hadoop.hbase.HTableDescriptor;
import .apache.hadoop.hbase.TableName;
import .apache.hadoop.hbase.client.*;
import .apache.hadoop.conf.Configuration;
import java.io.IOException;
I've included all of the JAR files from the lib folder of HBase2.6.1-hadoop3 and imported these classes.
public class Upload {
public static void main(String args[]) throws IOException
{
Configuration conf = HBaseConfiguration.create();
When this part of the code runs, I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: /slf4j/LoggerFactory
at .apache.hadoop.conf.Configuration.<clinit>(Configuration.java:230)
at Upload.main(Upload.java:15)
Caused by: java.lang.ClassNotFoundException: .slf4j.LoggerFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 2 more
Is there any way to fix this?
Share Improve this question asked Mar 30 at 0:28 Crimson JesterCrimson Jester 1 5 |1 Answer
Reset to default 0Check under the external dependencies/libraries in your project in whatever ide you are using, for the slf4j dependency/library and see where its coming under,apart from the actual sl4j dependency ,under the external dependencies/libraries,if it appears in more than one place ,one of the dependencies needs to be removed ,so if you want to use slf4j logging statements ,you can try using the slf4j from the other dependency/library not from original slf4j dependency/library
Modulepath
. However you are gettingNoClassDefFoundError
which means your code compiles which means the build path should be correct. Edit your question and post the "run" command. See "Show Command Line" button. – Abra Commented Mar 30 at 4:18