java.lang.ClassCastException: kafka.message.Message cannot be cast to [B

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Solutions on the web

via Apache's JIRA Issue Tracker by Andrew Milkowski, 1 year ago
kafka.message.Message cannot be cast to [B
via Stack Overflow by Unknown author, 2 years ago
java.lang.String cannot be cast to [B
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 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 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)

Users with the same issue

Samebug visitor profile picture
Unknown user
Once, 1 year ago

Know the solutions? Share your knowledge to help other developers to debug faster.