joekiller / jruby-kafka

Apache License 2.0
71 stars 52 forks source link

cannot load Java class kafka.consumer.ConsumerIterator #28

Closed alexphys closed 9 years ago

alexphys commented 9 years ago

Hi , I have the following error after I have a successful bundle and try to execute my app

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

Any suggestions?

joekiller commented 9 years ago

Are you using the latest gemfile? On May 10, 2015 6:11 AM, "alexphys" notifications@github.com wrote:

Hi , I have the following error after I have a successful bundle and try to execute my app

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

Any suggestions?

— Reply to this email directly or view it on GitHub https://github.com/joekiller/jruby-kafka/issues/28.

alexphys commented 9 years ago

Sorry for the late responce. In the end it wasn't gem's problem but the way I had jruby installed through rvm. I went on and uninstalled it and reinstalled jruby specifying the ruby api

rvm install jruby --1.9

and when I bundle installed the gem again it fetched the jars as it should.

daluu commented 9 years ago

I got similar error:

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:/Users/daluu/.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:/Users/daluu/.rvm/rubies/jruby-1.7.19/lib/jruby.jar!/jruby/java/core_ext/object.rb:22 (root) at /Users/daluu/.rvm/gems/jruby-1.7.19/gems/jruby-kafka-0.1.0/lib/jruby-kafka/consumer.rb:4 require at org/jruby/RubyKernel.java:1071 (root) at /Users/daluu/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1 require at /Users/daluu/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:54 require at org/jruby/RubyKernel.java:1071 (root) at /Users/daluu/.rvm/gems/jruby-1.7.19/gems/jruby-kafka-0.1.0/lib/jruby-kafka.rb:1 (root) at kafka_readj.rb:1

Is there a certain sequence of steps involved?

I didn't build from source per Github readme, but just only added the gem in Gemfile for using the RubyGem version, is that not latest or I need to force latest version? It's installed in list of gems

I had jruby installed originally with "rvm install jruby" then I uninstalled with "rvm uninstall jruby" and reinstalled with suggestion here. Still have issue.

I'm connecting to an existing Kafka server remotely (not localhost installation). Do I still need some Java JARs or setting path?

I have Kafka installed locally via brew . Have a bunch of shell scripts under /usr/local/bin. But I don't know where any matching JARs and path are.

Do I need to set path to anything under

/usr/local/Cellar/kafka/0.8.2.1/libexec/bin /usr/local/Cellar/kafka/0.8.2.1/libexec/clients

joekiller commented 9 years ago

If you are using rvm do a rvm list and make sure jruby is being used. Try rvm use jruby and then gem install jruby-kafka On Jun 15, 2015 5:56 PM, "David Luu" notifications@github.com wrote:

I got similar error:

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:/Users/daluu/.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:/Users/daluu/.rvm/rubies/jruby-1.7.19/lib/jruby.jar!/jruby/java/core_ext/object.rb:22 (root) at /Users/daluu/.rvm/gems/jruby-1.7.19/gems/jruby-kafka-0.1.0/lib/jruby-kafka/consumer.rb:4 require at org/jruby/RubyKernel.java:1071 (root) at /Users/daluu/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1 require at /Users/daluu/.rvm/rubies/jruby-1.7.19/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:54 require at org/jruby/RubyKernel.java:1071 (root) at /Users/daluu/.rvm/gems/jruby-1.7.19/gems/jruby-kafka-0.1.0/lib/jruby-kafka.rb:1 (root) at kafka_readj.rb:1

Is there a certain sequence of steps involved?

I didn't build from source per Github readme, but just only added the gem in Gemfile for using the RubyGem version, is that not latest or I need to force latest version? It's installed in list of gems

I had jruby installed originally with "rvm install jruby" then I uninstalled with "rvm uninstall jruby" and reinstalled with suggestion here. Still have issue.

I'm connecting to an existing Kafka server remotely (not localhost installation). Do I still need some Java JARs or setting path?

I have Kafka installed locally via brew . Have a bunch of shell scripts under /usr/local/bin. But I don't know where any matching JARs and path are.

Do I need to set path to anything under

/usr/local/Cellar/kafka/0.8.2.1/libexec/bin /usr/local/Cellar/kafka/0.8.2.1/libexec/clients

— Reply to this email directly or view it on GitHub https://github.com/joekiller/jruby-kafka/issues/28#issuecomment-112221839 .

joekiller commented 9 years ago

Looks like you are using jruby-kakfa 0.1.0 which is quite old. Install the latest instead.

daluu commented 9 years ago

Can I install latest via rubygems.org or need to build from source? The default install doesn't give you the latest? What's the latest version?

joekiller commented 9 years ago

Try version 1.4.0. I'm not sure why it does 0.1.0

On Tue, Jun 16, 2015 at 12:10 AM, David Luu notifications@github.com wrote:

Can I install latest via rubygems.org or need to build from source? The default install doesn't give you the latest? What's the latest version?

— Reply to this email directly or view it on GitHub https://github.com/joekiller/jruby-kafka/issues/28#issuecomment-112279555 .