joekiller / jruby-kafka

Apache License 2.0
71 stars 52 forks source link

java.lang.NoClassDefFoundError: Could not initialize class org.apache.kafka.clients.producer.ProducerConfig #53

Closed sziep closed 7 years ago

sziep commented 8 years ago

Hi Joe,

I'm running jruby 1.7.25 and using the 3.6.0 branch to be able to target kafka 0.9 brokers. When constructing a Producer like:

KAFKA_PRODUCER_OPTIONS = {
    :bootstrap_servers => '127.0.0.1:9092',
    :key_serializer => 'org.apache.kafka.common.serialization.StringSerializer',
    :value_serializer => 'org.apache.kafka.common.serialization.StringSerializer',
}

producer = Kafka::KafkaProducer.new(KAFKA_PRODUCER_OPTIONS)

it fails with: java.lang.NoClassDefFoundError: Could not initialize class org.apache.kafka.clients.producer.ProducerConfig org.apache.kafka.clients.producer.KafkaProducer.(org/apache/kafka/clients/producer/KafkaProducer.java:181) ...

From what I can see this has to do with dynamic class loading issues in kafka 0.9.

joekiller commented 8 years ago

Are you building the gem yourself? Make sure you run rake install_jars

https://github.com/joekiller/jruby-kafka/blob/master/DEVELOPMENT.md

Hi Joe,

I'm running jruby 1.7.25 and using the 3.6.0 branch to be able to target kafka 0.9 brokers. When constructing a Producer like:

KAFKA_PRODUCER_OPTIONS = { :bootstrap_servers => '127.0.0.1:9092', :key_serializer => 'org.apache.kafka.common.serialization.StringSerializer', :value_serializer => 'org.apache.kafka.common.serialization.StringSerializer', }

producer = Kafka::KafkaProducer.new(KAFKA_PRODUCER_OPTIONS)

it fails with: java.lang.NoClassDefFoundError: Could not initialize class org.apache.kafka.clients.producer.ProducerConfig org.apache.kafka.clients.producer.KafkaProducer.(org/apache/kafka/clients/producer/KafkaProducer.java:181) ...

From what I can see this has to do with dynamic class loading issues in kafka 0.9.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/joekiller/jruby-kafka/issues/53, or mute the thread https://github.com/notifications/unsubscribe/AA-bx2D0sqSb75u848GhDQbN5GbQ0JAmks5qVO9PgaJpZM4JLcn7 .

sziep commented 8 years ago

No, just wanted to give you a heads up that the latest kafka 0.9 (3.6.0) branch is not usable. Going back to 2.2.2 fixed the issue for me. Surprisingly I can send messages to 0.9 brokers.

joekiller commented 8 years ago

Are you using the 3.6.0 gem or branch?

-Joe Sent via mobile. On Jul 13, 2016 11:31 AM, "Stephan Ziep" notifications@github.com wrote:

No, just wanted to give you a heads up that the latest kafka 0.9 (3.6.0) branch is not usable. Going back to 2.2.2 fixed the issue for me. Surprisingly I can send messages to 0.9 brokers.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/joekiller/jruby-kafka/issues/53#issuecomment-232392824, or mute the thread https://github.com/notifications/unsubscribe/AA-bx3Cs2eJ8hNm7sRQflbG1CjlFADQAks5qVQTOgaJpZM4JLcn7 .

joekiller commented 8 years ago

Are your brokers in 0.8 compatibility mode? http://kafka.apache.org/090/documentation.html#upgrade

Upgraded brokers and clients are not compatible otherwise.

v3.6.0 passed all tests using Kafka 0.9.0.1 https://travis-ci.org/joekiller/jruby-kafka/builds/117786218

sziep commented 8 years ago

I was using the gems, not the branches directly. My broker is not in compatibility mode, i just checked. Its 0.9 without special settings. Curious...

My setup has two docker containers. One is producing via a Sinatra App running on Jubillee / Vert.x, the other one is Kafka receiving messages.

joekiller commented 8 years ago

Okay any steps.to replicate would be appreciated. On Jul 14, 2016 2:36 AM, "Stephan Ziep" notifications@github.com wrote:

I was using the gems, not the branches directly. My broker is not in compatibility mode, i just checked. Its 0.9 without special settings. Curious...

My setup has two docker containers. One is producing via a Sinatra App running on Jubillee / Vert.x, the other one is Kafka receiving messages.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/joekiller/jruby-kafka/issues/53#issuecomment-232571379, or mute the thread https://github.com/notifications/unsubscribe/AA-bxz9SoqxShS3ljWZK1VWtY1laxdVRks5qVdjpgaJpZM4JLcn7 .