java - 运行 "hbase shell"在 OSX 中给出错误

标签 java ruby macos hadoop hbase

尝试在 OSX(版本:10.11.4)中运行 hbase shell 时出现以下错误:

warning: -J-Dfile.encoding=UTF-8 argument ignored (launched in same VM?)

warning: -J-XX:MaxPermSize=1024m argument ignored (launched in same VM?)

warning: -J-Xmx4096m argument ignored (launched in same VM?)

TypeError: can't convert Pathname into String require at org/jruby/RubyKernel.java:1071

require at file:/usr/local/Cellar/hbase/1.2.6/libexec/lib/jruby-complete-1.6.8.jar!/META INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36

(root) at /usr/local/Cellar/hbase/1.2.6/libexec/bin/hirb.rb:118

我用 brew 安装了 Hbase:brew install hbase

解决方案中给出 here ,我也尝试像下面这样设置 PATH 变量:

➜  ~ export HBASE_HOME=/usr/local/Cellar/hbase/1.2.6/libexec
➜  ~ export PATH=$HBASE_HOME/bin:$PATH

我在 $HBASE_HOME/lib 中也有 jruby-complete-1.6.8.jar,如 here 所述.但仍然出现同样的错误。

编辑1

➜ rvm list:

rvm rubies

   ruby-2.1.2 [ x86_64 ]
   ruby-2.2.0 [ x86_64 ]
=* ruby-2.2.2 [ x86_64 ]

# => - current
# =* - current && default
#  * - default


➜  ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]


➜  which ruby
/usr/bin/ruby

猜测是 rvm 出了问题,我通过以下方式卸载了它:rvm removervm uninstall。但错误仍然存​​在。

编辑2

➜  brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  mongodb@2.6

Warning: Your Xcode (7.3.1) is outdated.
Please update to Xcode 8.2.1 (or delete it).
Xcode can be updated from the App Store.


Warning: Some installed formula are missing dependencies.
You should `brew install` the missing dependencies:
  brew install erlang@19

Run `brew missing` for more details.

➜  brew missing
rabbitmq: erlang@19

编辑3

我发现我能够以 root 用户身份运行 HBASE,所以如果我执行以下操作:

> Sudo su
root> export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
root> hbase shell
       ......It works......

看来是权限问题,导致无法正常运行。

最佳答案

您是否尝试过使用 Oracle 的 JDK 并从 Apache 页面安装?

http://ftp.ps.pl/pub/apache/hbase/1.3.1/hbase-1.3.1-bin.tar.gz

在我的情况下它工作得很好

> ./start-hbase.sh
starting master, logging to $HOME/..../hbase-1.3.1/bin/../logs/hbase-michalo-master-pi.local.out
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0

并且,在另一个 shell 中

> ./hbase shell
WARN  [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.3.1, r930b9a55528fe45d8edce7af42fef2d35e77677a, Thu Apr  6 19:36:54 PDT 2017

hbase(main):001:0>

关于java - 运行 "hbase shell"在 OSX 中给出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45301184/

相关文章:

java - java 小程序错误

java - 未知的 Java 7 功能

javascript - 限制 Rails 循环中的 collection_check_boxes 选择

ios - 强制单轴速度

objective-c - 有谁知道 Mac OS X 应用程序的 Safari 风格选项卡控件?

java - MySQL数据库查询和更新

java - JMS 使用哪种协议(protocol)来发送和接收消息?

ruby - 如何进行 Mechanize 多重搜索?

ruby - Nokogiri XPath 找不到某些节点

macos - 如何(启用/禁用)在 macOS 上通过标题栏查看模糊的可滚动内容