java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/MasterNotRunningException
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4864520/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/MasterNotRunningException
提问by knt
I created by own HBase java client code, but I am having a really difficult time compiling it and getting it to run. I am compiling from the command line, and I havent been able to find any instructions how to do this, or what jars I need to have on my classpath.
我是用自己的 HBase java 客户端代码创建的,但是我很难编译它并让它运行。我正在从命令行进行编译,但我无法找到任何有关如何执行此操作的说明,或者我的类路径上需要有哪些 jar。
Below is the classpath I'm using:
下面是我正在使用的类路径:
$HADOOP_HOME/hadoop/hadoop-0.20.2/hadoop-0.20.2-core.jar:
$HADOOP_HOME/hbase/hbase-0.90.0/hbase-0.90.0.jar:
$HADOOP_HOME/hbase/lib/zookeeper-3.3.2.jar
When I run the javac command, it compiles fine. However, when I run my java code, I get the below error:
当我运行 javac 命令时,它编译得很好。但是,当我运行 Java 代码时,出现以下错误:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/MasterNotRunningException
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.MasterNotRunningException
at java.net.URLClassLoader.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: HBaseConnection. Program will exit.
What am I missing?
我错过了什么?
Thanks!
谢谢!
回答by Thorbj?rn Ravn Andersen
The class org.apache.hadoop.hbase.MasterNotRunning is not available on the classpath. You most likely have not set up the classpath to include the hadoop jar. This can be as simple as a misspelling (and $HOME must be expanded).
类 org.apache.hadoop.hbase.MasterNotRunning 在类路径上不可用。您很可能还没有设置类路径来包含 hadoop jar。这可以像拼写错误一样简单(并且必须扩展 $HOME)。
回答by sterin jacob
Make sure that native files are newly build in the system .
确保本机文件是系统中新构建的。
Wrong:
错误的:
[hduser@master sbin]$ hadoop fs -ls /
[hduser@master sbin]$ hadoop fs -ls /
16/07/17 15:38:17 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
16/07/17 15:38:17 警告 util.NativeCodeLoader:无法为您的平台加载本机 Hadoop 库...在适用的情况下使用内置 Java 类
Found 5 items drwxr-xr-x - hduser supergroup 0 2016-07-17 10:57 /cm
找到 5 个项目 drwxr-xr-x - hduser 超级组 0 2016-07-17 10:57 /cm
Correct
正确的
[hduser@master sbin]$ hadoop fs -ls /
[hduser@master sbin]$ hadoop fs -ls /
Found 5 items
找到 5 个项目
drwxr-xr-x - hduser supergroup 0 2016-07-17 10:57 /cm
drwxr-xr-x - hduser 超组 0 2016-07-17 10:57 /cm
in wrong configuration , follow below link to build it http://www.myiphoneadventure.com/hardware/hadoop-build-native-library
在错误的配置中,按照以下链接构建它 http://www.myiphoneadventure.com/hardware/hadoop-build-native-library
For Hadoop 2.7.2 on RHL 6 GLIBC_2.12 , you can use https://github.com/sterin501/SecureHadoop/tree/master/native
对于 RHL 6 GLIBC_2.12 上的 Hadoop 2.7.2,您可以使用 https://github.com/sterin501/SecureHadoop/tree/master/native
For Complete hadoop 2.7.2 setup : http://wccandlinux.blogspot.in/2016/07/how-to-configure-hadoop-with-kerberos.html
对于完整的 hadoop 2.7.2 设置:http: //wccandlinux.blogspot.in/2016/07/how-to-configure-hadoop-with-kerberos.html