启动 hbase 时找不到 JAVA_HOME。有什么建议吗?

发布于 2025-01-05 21:47:59 字数 1402 浏览 1 评论 0原文

我只是在玩 hbase(在 EC2 上),当我启动它时遇到问题。这是我得到的:

[root@domU-12-31-39-13-D6-62 ~]# sudo /etc/init.d/hadoop-hbase-master start
+======================================================================+
|      Error: JAVA_HOME is not set and Java could not be found         |
+----------------------------------------------------------------------+
| Please download the latest Sun JDK from the Sun Java web site        |
|       > http://java.sun.com/javase/downloads/ <                      |
|                                                                      |
| HBase requires Java 1.6 or later.                                    |
| NOTE: This script will find Sun Java whether you install using the   |
|       binary or the RPM based installer.                             |
+======================================================================+

我查找了错误并安装了 openjdk 1.6,并在 .bash_profile 和 /etc/profile 中设置了 java_home 变量(以防 hbase 以不同用户身份运行)。好像已经生效了:

[root@domU-12-31-39-13-D6-62 ~]# java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.4) (rhel-1.42.1.10.4.el6_2-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
[root@domU-12-31-39-13-D6-62 ~]# echo $JAVA_HOME
/usr/bin/java

但是启动hbase的时候还是出现这个错误。我对java不太熟悉,所以我不确定我做错了什么。如果有帮助的话,我在 ec2 上使用 centos6,并在 hbase/hadoop 包的 cloudera 存储库中使用。

I'm just playing around with hbase( on EC2) and am having a problem when I launch it. Here's what I get:

[root@domU-12-31-39-13-D6-62 ~]# sudo /etc/init.d/hadoop-hbase-master start
+======================================================================+
|      Error: JAVA_HOME is not set and Java could not be found         |
+----------------------------------------------------------------------+
| Please download the latest Sun JDK from the Sun Java web site        |
|       > http://java.sun.com/javase/downloads/ <                      |
|                                                                      |
| HBase requires Java 1.6 or later.                                    |
| NOTE: This script will find Sun Java whether you install using the   |
|       binary or the RPM based installer.                             |
+======================================================================+

I looked up the error and installed openjdk 1.6 and set the java_home variable in my .bash_profile and in /etc/profile(just in case hbase is running as a different user). It seems to have taken effect:

[root@domU-12-31-39-13-D6-62 ~]# java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.4) (rhel-1.42.1.10.4.el6_2-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
[root@domU-12-31-39-13-D6-62 ~]# echo $JAVA_HOME
/usr/bin/java

but I still get this error when launching hbase. I'm not that famlair with java so I'm not sure what I'm doing wrong. If it helps, I'm using centos6 on ec2 and cloudera's repository for the hbase/hadoop packages.

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

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

发布评论

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

评论(5

救星 2025-01-12 21:47:59

JAVA_HOME 不应该指向 java 可执行文件',而应该指向可以找到其余 java 文件的位置。

我认为它是 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/。我
认为您可以使用 update-alternatives --display java 来显示所有已安装的 java。

JAVA_HOME shouldn't point to the java executable ', but rather to the place where the rest of the java files can be found.

I think it's /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/. I
Think you can use update-alternatives --display java to show all javas installed.

梦幻之岛 2025-01-12 21:47:59

检查您的脚本 /etc/init.d/hadoop-hbase-master 并查看它在哪里尝试查找 java 并且您可以在调试模式下运行它。

sh -x /etc/init.d/hadoop-hbase-master 启动

Check your script /etc/init.d/hadoop-hbase-master and see where it trying to find java also your can run it in debug mode.

sh -x /etc/init.d/hadoop-hbase-master start

公布 2025-01-12 21:47:59

如果您已经在 bashrc 中设置了 JAVA_HOME 但它仍然不起作用,请尝试在 /etc/environment 文件中设置它。

In case you have already set JAVA_HOME in bashrc and still it is not working, try setting it in /etc/environment file.

水波映月 2025-01-12 21:47:59

如果您想快速检查,可以在 /etc/init.d/hadoop-hbase-master 脚本中硬编码 JAVA 路径。

You can hard code your JAVA path in your /etc/init.d/hadoop-hbase-master script if you want to quick check.

苯莒 2025-01-12 21:47:59

可能 $JAVA_HOME 指向 JRE 主目录。检查确认 bin 中是否存在 javac

Probably $JAVA_HOME is pointing to a JRE home. Check to confirm if javac is present in the bin

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