You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "drunkedcat (JIRA)" <ji...@apache.org> on 2013/11/22 04:44:35 UTC

[jira] [Commented] (KAFKA-933) Hadoop example running DataGenerator causes kafka.message.Message cannot be cast to [B exception

    [ https://issues.apache.org/jira/browse/KAFKA-933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13829627#comment-13829627 ] 

drunkedcat commented on KAFKA-933:
----------------------------------

as 0.8.0-bete1, the following change will work:

                        byte[] bytes = timestamp.toString().getBytes("UTF8");
-                       Message message = new Message(bytes);
-                       list.add(new KeyedMessage<Integer, Message>(_topic, null, message));
+
+                       list.add(new KeyedMessage<Integer, byte[]>(_topic, null, bytes));
                }


> Hadoop example running DataGenerator causes kafka.message.Message cannot be cast to [B exception
> ------------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-933
>                 URL: https://issues.apache.org/jira/browse/KAFKA-933
>             Project: Kafka
>          Issue Type: Bug
>          Components: contrib
>    Affects Versions: 0.8
>         Environment: [amilkowski@localhost ~]$ uname -a
> Linux localhost.localdomain 3.9.4-200.fc18.x86_64 #1 SMP Fri May 24 20:10:49 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
> [amilkowski@localhost ~]$ 
>            Reporter: Andrew Milkowski
>            Priority: Minor
>              Labels: hadoop
>             Fix For: 0.8.1
>
>
> Working of git master codebase
> and following instructions at
> https://github.com/apache/kafka/blob/trunk/contrib/hadoop-consumer/README
> https://github.com/apache/kafka
> when running
> ./run-class.sh kafka.etl.impl.DataGenerator test/test.properties
> an exception is thrown
> Exception in thread "main" java.lang.ClassCastException: kafka.message.Message cannot be cast to [B
> 	at kafka.serializer.DefaultEncoder.toBytes(Encoder.scala:34)
> 	at kafka.producer.async.DefaultEventHandler$$anonfun$serialize$1.apply(DefaultEventHandler.scala:129)
> 	at kafka.producer.async.DefaultEventHandler$$anonfun$serialize$1.apply(DefaultEventHandler.scala:124)
> 	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
> 	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
> 	at scala.collection.Iterator$class.foreach(Iterator.scala:772)
> 	at scala.collection.JavaConversions$JIteratorWrapper.foreach(JavaConversions.scala:573)
> 	at scala.collection.IterableLike$class.foreach(IterableLike.scala:73)
> 	at scala.collection.JavaConversions$JListWrapper.foreach(JavaConversions.scala:615)
> 	at scala.collection.TraversableLike$class.map(TraversableLike.scala:233)
> 	at scala.collection.JavaConversions$JListWrapper.map(JavaConversions.scala:615)
> 	at kafka.producer.async.DefaultEventHandler.serialize(DefaultEventHandler.scala:124)
> 	at kafka.producer.async.DefaultEventHandler.handle(DefaultEventHandler.scala:54)
> 	at kafka.producer.Producer.send(Producer.scala:74)
> 	at kafka.javaapi.producer.Producer.send(Producer.scala:41)



--
This message was sent by Atlassian JIRA
(v6.1#6144)