java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/MasterNotRunningException

发布于 2024-10-15 07:04:50 字数 1073 浏览 4 评论 0原文

我是用自己的 HBase java 客户端代码创建的,但是我在编译它并让它运行时遇到了非常困难的时间。我正在从命令行进行编译,但我无法找到任何说明如何执行此操作,或者我的类路径上需要有哪些 jar。

下面是我正在使用的类路径:

$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

当我运行 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$1.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.  

我缺少什么?

谢谢!

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.

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:

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$1.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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

琉璃繁缕 2024-10-22 07:04:50

类 org.apache.hadoop.hbase.MasterNotRunning 在类路径上不可用。您很可能没有设置类路径来包含 hadoop jar。这可以像拼写错误一样简单(并且 $HOME 必须扩展)。

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).

莫相离 2024-10-22 07:04:50

确保本机文件是在系统中新构建的。

错误:

[hduser@master sbin]$ hadoop fs -ls /

16/07/17 15:38:17 WARN util.NativeCodeLoader:无法为您的平台加载本机hadoop库...在适用的情况下使用内置java类

找到5 项目
drwxr-xr-x - hduser supergroup 0 2016-07-17 10:57 /cm

正确

[hduser@master sbin]$ hadoop fs -ls /

找到 5 项

drwxr-xr-x - hduser supergroup 0 2016-07-17 10 :57 /cm

配置错误,请按照以下链接进行构建
http://www.myiphoneadventure.com/hardware/hadoop-build-native-library

对于 RHL 6 GLIBC_2.12 上的 Hadoop 2.7.2 ,您可以使用
https://github.com/sterin501/SecureHadoop/tree/master/native

对于完整的 hadoop 2.7.2 设置:
http://wccandlinux.blogspot.in/2016 /07/how-to-configure-hadoop-with-kerberos.html

Make sure that native files are newly build in the system .

Wrong:

[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

Found 5 items
drwxr-xr-x - hduser supergroup 0 2016-07-17 10:57 /cm

Correct

[hduser@master sbin]$ hadoop fs -ls /

Found 5 items

drwxr-xr-x - hduser supergroup 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

For Hadoop 2.7.2 on RHL 6 GLIBC_2.12 , you can use
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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文