flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prateekarora <prateek.arora...@gmail.com>
Subject Getting java.lang.Exception when try to fetch data from Kafka
Date Fri, 22 Apr 2016 20:21:19 GMT

Hi

I am sending data using kafkaProducer API

                       imageRecord = new ProducerRecord<String,
byte[]>(topic,messageKey, imageData);
                        producer.send(imageRecord);


And in flink program  try to fect data using FlinkKafkaConsumer08 . below
are the sample code .

    def main(args: Array[String]) {
          val env = StreamExecutionEnvironment.getExecutionEnvironment
          val properties = new Properties()
          properties.setProperty("bootstrap.servers", "<IPADDRESS>:9092")
          properties.setProperty("zookeeper.connect", "<IPADDRESS>:2181")
          properties.setProperty("group.id", "test")

          val readSchema = new
TypeInformationKeyValueSerializationSchema[String,Array[Byte]](classOf[String],classOf[Array[Byte]],
env.getConfig).asInstanceOf[KeyedDeserializationSchema[(String,Array[Byte])]]

          val stream : DataStream[(String,Array[Byte])]  = env.addSource(new
FlinkKafkaConsumer08[(String,Array[Byte])]("a-0",readSchema, properties))

          stream.print
          env.execute("Flink Kafka Example")
  }


but getting  below error :

16/04/22 13:43:39 INFO ExecutionGraph: Source: Custom Source -> Sink:
Unnamed (1/4) (d7a151560f6eabdc587a23dc0975cb84) switched from RUNNING to
FAILED
16/04/22 13:43:39 INFO ExecutionGraph: Source: Custom Source -> Sink:
Unnamed (2/4) (d43754a27e402ed5b02a73d1c9aa3125) switched from RUNNING to
CANCELING

java.lang.Exception
    at
org.apache.flink.streaming.connectors.kafka.internals.LegacyFetcher.run(LegacyFetcher.java:222)
    at
org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer08.run(FlinkKafkaConsumer08.java:316)
    at
org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:78)
    at
org.apache.flink.streaming.runtime.tasks.SourceStreamTask.run(SourceStreamTask.java:56)
    at
org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:225)
    at org.apache.flink.runtime.taskmanager.Task.run(Task.java:559)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.EOFException
    at
org.apache.flink.runtime.util.DataInputDeserializer.readUnsignedByte(DataInputDeserializer.java:298)
    at org.apache.flink.types.StringValue.readString(StringValue.java:771)
    at
org.apache.flink.api.common.typeutils.base.StringSerializer.deserialize(StringSerializer.java:69)
    at
org.apache.flink.api.common.typeutils.base.StringSerializer.deserialize(StringSerializer.java:28)
    at
org.apache.flink.streaming.util.serialization.TypeInformationKeyValueSerializationSchema.deserialize(TypeInformationKeyValueSerializationSchema.java:105)
    at
org.apache.flink.streaming.util.serialization.TypeInformationKeyValueSerializationSchema.deserialize(TypeInformationKeyValueSerializationSchema.java:39)
    at
org.apache.flink.streaming.connectors.kafka.internals.LegacyFetcher$SimpleConsumerThread.run(LegacyFetcher.java:657)


Regards
Prateek




--
View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Getting-java-lang-Exception-when-try-to-fetch-data-from-Kafka-tp6365.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.

Mime
View raw message