启动 hbase 时找不到 JAVA_HOME。有什么建议吗?
我只是在玩 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
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 thejava
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/
. IThink you can use
update-alternatives --display java
to show all javas installed.检查您的脚本 /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
如果您已经在 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.
如果您想快速检查,可以在 /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.
可能 $JAVA_HOME 指向 JRE 主目录。检查确认 bin 中是否存在 javac
Probably $JAVA_HOME is pointing to a JRE home. Check to confirm if javac is present in the bin