admin 管理员组文章数量: 1086019
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
本文标签: javaWhy am I getting a ClassNotFoundException for hadoopconfConfiguration in EclipseStack Overflow
版权声明:本文标题:java - Why am I getting a ClassNotFoundException for hadoop.conf.Configuration in Eclipse? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1744000213a2516307.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
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