无法加载 Java class kafka.consumer.ConsumerIterator
cannot load Java class kafka.consumer.ConsumerIterator
我正在使用以下 gem
https://github.com/joekiller/jruby-kafka
我安装了java:
$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
并使用
jruby-1.7.19
成功后 bundle install
我在尝试执行我的应用程序时遇到以下错误
NameError: cannot load Java class kafka.consumer.ConsumerIterator
for_name at org/jruby/javasupport/JavaClass.java:1286
get_proxy_class at org/jruby/javasupport/JavaUtilities.java:34
java_import at file:/home/user/.rvm/rubies/jruby-1.7.19/lib/jruby.jar!/jruby/java/core_ext/object.rb:27
map at org/jruby/RubyArray.java:2412
java_import at file:/home/user/.rvm/rubies/jruby-1.7.19/lib/jruby.jar!/jruby/java/core_ext/object.rb:22
Consumer at /home/user/.rvm/gems/jruby-1.7.19/gems/jruby-kafka-1.4.0-java/lib/jruby-kafka/consumer.rb:6
(root) at /home/user/.rvm/gems/jruby-1.7.19/gems/jruby-kafka-1.4.0-java/lib/jruby-kafka/consumer.rb:5
require at org/jruby/RubyKernel.java:1071
require at /home/user/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:69
(root) at /home/user/.rvm/gems/jruby-1.7.19/gems/jruby-kafka-1.4.0-java/lib/jruby-kafka.rb:1
require at org/jruby/RubyKernel.java:1071
require at /home/user/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:128
require at /home/user/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:121
(root) at app.rb:4
这是在 ubuntu 14.04 中完成的。
当安装到具有相同设置(os、jvm、rvm、jruby 版本)的其他系统时,该应用程序可以正常工作 - 没有错误。我怀疑这与 jar 文件本身的路径有关。
有什么建议吗?
当我完全删除 jruby 并通过同时说明 ruby.
重新安装时问题解决了
rvm install jruby --1.9
这次 gem 与 jar 依赖项一起安装。
我正在使用以下 gem https://github.com/joekiller/jruby-kafka
我安装了java:
$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
并使用
jruby-1.7.19
成功后 bundle install
我在尝试执行我的应用程序时遇到以下错误
NameError: cannot load Java class kafka.consumer.ConsumerIterator
for_name at org/jruby/javasupport/JavaClass.java:1286
get_proxy_class at org/jruby/javasupport/JavaUtilities.java:34
java_import at file:/home/user/.rvm/rubies/jruby-1.7.19/lib/jruby.jar!/jruby/java/core_ext/object.rb:27
map at org/jruby/RubyArray.java:2412
java_import at file:/home/user/.rvm/rubies/jruby-1.7.19/lib/jruby.jar!/jruby/java/core_ext/object.rb:22
Consumer at /home/user/.rvm/gems/jruby-1.7.19/gems/jruby-kafka-1.4.0-java/lib/jruby-kafka/consumer.rb:6
(root) at /home/user/.rvm/gems/jruby-1.7.19/gems/jruby-kafka-1.4.0-java/lib/jruby-kafka/consumer.rb:5
require at org/jruby/RubyKernel.java:1071
require at /home/user/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:69
(root) at /home/user/.rvm/gems/jruby-1.7.19/gems/jruby-kafka-1.4.0-java/lib/jruby-kafka.rb:1
require at org/jruby/RubyKernel.java:1071
require at /home/user/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:128
require at /home/user/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:121
(root) at app.rb:4
这是在 ubuntu 14.04 中完成的。 当安装到具有相同设置(os、jvm、rvm、jruby 版本)的其他系统时,该应用程序可以正常工作 - 没有错误。我怀疑这与 jar 文件本身的路径有关。 有什么建议吗?
当我完全删除 jruby 并通过同时说明 ruby.
重新安装时问题解决了rvm install jruby --1.9
这次 gem 与 jar 依赖项一起安装。