You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Praveen.A" <Pr...@target.com> on 2015/09/08 13:45:39 UTC

Exception while pushing Avro messages into Kafka

Hello Experts,

We are trying to push Avro formatted message into Kafka through Camel and caught with below exception so couldn't succeeded further.

I have attached the complete source code along with pom.xml file for version details.

Please let us know the best way of pushing Avro messages into Kafka through camel integration.

15/09/08 16:43:21 INFO utils.VerifiableProperties: Verifying properties
15/09/08 16:43:21 INFO utils.VerifiableProperties: Property metadata.broker.list is overridden to edelx0002:9092
15/09/08 16:43:21 INFO utils.VerifiableProperties: Property partitioner.class is overridden to kafka.producer.DefaultPartitioner
15/09/08 16:43:21 INFO utils.VerifiableProperties: Property request.required.acks is overridden to 0
15/09/08 16:43:21 INFO utils.VerifiableProperties: Property serializer.class is overridden to kafka.serializer.DefaultEncoder
Exception in thread "main" java.lang.NullPointerException
       at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:67)
       at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47)
       at org.apache.camel.component.kafka.KafkaProducer.process(KafkaProducer.java:72)
       at com.tgt.stores.CamelAvroProducer.processItemMessage(CamelAvroProducer.java:145)
       at com.tgt.stores.TestProducer.main(TestProducer.java:12)


Regards,
Praveen

RE: Exception while pushing Avro messages into Kafka

Posted by Andrew Block <an...@gmail.com>.
Praveen,

After reviewing your code, I only see you starting manually starting up the Kafka Producer and Endpoint manually and sending an exchange to the producer. Take a look at the Camel standalone example [1] on how you can create a spin up a standalone camel context with route. Not running a Camel Context is likely the reason for the exception. 

- Andy

[1] - http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html

-- 
Andrew Block


On September 9, 2015 at 1:46:15 AM, Praveen.A (praveen.a@target.com) wrote:

Hi Andrew,

 

I will correct the versions in pom.xml as there is no reason for having different versions and this time I have attached the source code in zip file.

 

Please have look at and let me know where I was making mistakes.

 

Regards,

Praveen

 

From: Andrew Block [mailto:andy.block@gmail.com]
Sent: Wednesday, September 09, 2015 8:52 AM
To: users@camel.apache.org; users-subscribe@camel.apache.org; Praveen.A <Pr...@target.com>
Subject: Re: Exception while pushing Avro messages into Kafka

 

Praveen,

 

The archive containing the source code did not come through so it is a bit difficult to trace from the POM file alone. One area I noticed from the POM is the majority of the Camel libraries are using version 2.10.1 while the Kafka component is at version 2.15.1. Is there a reason for the differences in library versions?

 

Also, have you looked into the Avro dataformat [1] for serialization if that is desired?

 

- Andy

 

[1] - http://camel.apache.org/avro.html 

 

 

-- 
Andrew Block

 

On September 8, 2015 at 2:56:07 PM, Praveen.A (praveen.a@target.com) wrote:

Hello Experts,

 

We are trying to push Avro formatted message into Kafka through Camel and caught with below exception so couldn’t succeeded further.

 

I have attached the complete source code along with pom.xml file for version details.

 

Please let us know the best way of pushing Avro messages into Kafka through camel integration.

 

15/09/08 16:43:21 INFO utils.VerifiableProperties: Verifying properties

15/09/08 16:43:21 INFO utils.VerifiableProperties: Property metadata.broker.list is overridden to edelx0002:9092

15/09/08 16:43:21 INFO utils.VerifiableProperties: Property partitioner.class is overridden to kafka.producer.DefaultPartitioner

15/09/08 16:43:21 INFO utils.VerifiableProperties: Property request.required.acks is overridden to 0

15/09/08 16:43:21 INFO utils.VerifiableProperties: Property serializer.class is overridden to kafka.serializer.DefaultEncoder

Exception in thread "main" java.lang.NullPointerException

       at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:67)

       at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47)

       at org.apache.camel.component.kafka.KafkaProducer.process(KafkaProducer.java:72)

       at com.tgt.stores.CamelAvroProducer.processItemMessage(CamelAvroProducer.java:145)

       at com.tgt.stores.TestProducer.main(TestProducer.java:12)

 

 

Regards,

Praveen


RE: Exception while pushing Avro messages into Kafka

Posted by "Praveen.A" <Pr...@target.com>.
Hi Andrew,

I will correct the versions in pom.xml as there is no reason for having different versions and this time I have attached the source code in zip file.

Please have look at and let me know where I was making mistakes.

Regards,
Praveen

From: Andrew Block [mailto:andy.block@gmail.com]
Sent: Wednesday, September 09, 2015 8:52 AM
To: users@camel.apache.org; users-subscribe@camel.apache.org; Praveen.A <Pr...@target.com>
Subject: Re: Exception while pushing Avro messages into Kafka

Praveen,

The archive containing the source code did not come through so it is a bit difficult to trace from the POM file alone. One area I noticed from the POM is the majority of the Camel libraries are using version 2.10.1 while the Kafka component is at version 2.15.1. Is there a reason for the differences in library versions?

Also, have you looked into the Avro dataformat [1] for serialization if that is desired?

- Andy

[1] - http://camel.apache.org/avro.html


--
Andrew Block


On September 8, 2015 at 2:56:07 PM, Praveen.A (praveen.a@target.com<ma...@target.com>) wrote:
Hello Experts,

We are trying to push Avro formatted message into Kafka through Camel and caught with below exception so couldn’t succeeded further.

I have attached the complete source code along with pom.xml file for version details.

Please let us know the best way of pushing Avro messages into Kafka through camel integration.

15/09/08 16:43:21 INFO utils.VerifiableProperties: Verifying properties
15/09/08 16:43:21 INFO utils.VerifiableProperties: Property metadata.broker.list is overridden to edelx0002:9092
15/09/08 16:43:21 INFO utils.VerifiableProperties: Property partitioner.class is overridden to kafka.producer.DefaultPartitioner
15/09/08 16:43:21 INFO utils.VerifiableProperties: Property request.required.acks is overridden to 0
15/09/08 16:43:21 INFO utils.VerifiableProperties: Property serializer.class is overridden to kafka.serializer.DefaultEncoder
Exception in thread "main" java.lang.NullPointerException
       at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:67)
       at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47)
       at org.apache.camel.component.kafka.KafkaProducer.process(KafkaProducer.java:72)
       at com.tgt.stores.CamelAvroProducer.processItemMessage(CamelAvroProducer.java:145)
       at com.tgt.stores.TestProducer.main(TestProducer.java:12)


Regards,
Praveen
________________________________

Re: Exception while pushing Avro messages into Kafka

Posted by Andrew Block <an...@gmail.com>.
Praveen,

The archive containing the source code did not come through so it is a bit difficult to trace from the POM file alone. One area I noticed from the POM is the majority of the Camel libraries are using version 2.10.1 while the Kafka component is at version 2.15.1. Is there a reason for the differences in library versions?

Also, have you looked into the Avro dataformat [1] for serialization if that is desired?

- Andy

[1] - http://camel.apache.org/avro.html 


-- 
Andrew Block


On September 8, 2015 at 2:56:07 PM, Praveen.A (praveen.a@target.com) wrote:

Hello Experts,

 

We are trying to push Avro formatted message into Kafka through Camel and caught with below exception so couldn’t succeeded further.

 

I have attached the complete source code along with pom.xml file for version details.

 

Please let us know the best way of pushing Avro messages into Kafka through camel integration.

 

15/09/08 16:43:21 INFO utils.VerifiableProperties: Verifying properties

15/09/08 16:43:21 INFO utils.VerifiableProperties: Property metadata.broker.list is overridden to edelx0002:9092

15/09/08 16:43:21 INFO utils.VerifiableProperties: Property partitioner.class is overridden to kafka.producer.DefaultPartitioner

15/09/08 16:43:21 INFO utils.VerifiableProperties: Property request.required.acks is overridden to 0

15/09/08 16:43:21 INFO utils.VerifiableProperties: Property serializer.class is overridden to kafka.serializer.DefaultEncoder

Exception in thread "main" java.lang.NullPointerException

       at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:67)

       at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47)

       at org.apache.camel.component.kafka.KafkaProducer.process(KafkaProducer.java:72)

       at com.tgt.stores.CamelAvroProducer.processItemMessage(CamelAvroProducer.java:145)

       at com.tgt.stores.TestProducer.main(TestProducer.java:12)

 

 

Regards,

Praveen