Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird exception when using Protobuf messages #134

Open
mvh77 opened this issue Apr 3, 2018 · 0 comments
Open

Weird exception when using Protobuf messages #134

mvh77 opened this issue Apr 3, 2018 · 0 comments

Comments

@mvh77
Copy link

mvh77 commented Apr 3, 2018

Hi,

I have a Scala/ScalaJS project with Protobuf messages defined in a shared project (Play Framework). On the JVM I try to use the these messages as values in Kafka topics and I've defined appropriate Serializers and Deserializers. These work fine. When I use the KafkaProducerActor with the serializer I get the following in the logs:

2018-04-02 19:36:20,607 [error] a.actor.OneForOneStrategy - class x.y.ProtobufMessage in JavaMirror with DependencyClassLoader{file:/home/mvh/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.12.4.jar, 

.... gazillion more lines of classpath .... 

file:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunjce_provider.jar,file:/usr/lib/jvm/java-8-oracle/jre/lib/ext/zipfs.jar,file:/usr/lib/jvm/java-8-oracle/jre/lib/ext/localedata.jar,file:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunec.jar,file:/usr/lib/jvm/java-8-oracle/jre/lib/ext/dnsns.jar,file:/usr/lib/jvm/java-8-oracle/jre/lib/ext/jfxrt.jar,file:/usr/lib/jvm/java-8-oracle/jre/lib/ext/cldrdata.jar] and parent being primordial classloader with boot classpath [/usr/lib/jvm/java-8-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar:/usr/lib/jvm/java-8-oracle/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-8-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-8-oracle/jre/classes] not found.
        at scala.reflect.internal.Mirrors$RootsBase.staticClass(Mirrors.scala:122)
        at scala.reflect.internal.Mirrors$RootsBase.staticClass(Mirrors.scala:22)
        at x.y.z.KafkaProducer$$typecreator4$1.apply(KafkaTraits.scala:25)
        at scala.reflect.api.TypeTags$WeakTypeTagImpl.tpe$lzycompute(TypeTags.scala:230)
        at scala.reflect.api.TypeTags$WeakTypeTagImpl.tpe(TypeTags.scala:230)
        at cakesolutions.kafka.akka.ProducerRecords$$typecreator1$1.apply(ProducerRecords.scala:143)
        at scala.reflect.api.TypeTags$WeakTypeTagImpl.tpe$lzycompute(TypeTags.scala:230)
        at scala.reflect.api.TypeTags$WeakTypeTagImpl.tpe(TypeTags.scala:230)
        at scala.reflect.api.TypeTags.typeOf(TypeTags.scala:339)
        at scala.reflect.api.TypeTags.typeOf$(TypeTags.scala:339)

x.y.ProtobufMessage is the (ScalaPB) message I'm trying to push to Kafka and KafkaTraits.scala:25 is:

private val protobufMessageProducerActor = 
  context.actorOf(KafkaProducerActor.props(producerConfig, 
    new StringSerializer(), 
    ProtobufMessageSerde), 
  "ProtobufMessageProducer")

Is there some special classloader/macro stuff going on where it doesn't find the implementation for my class because it's in the shared project? Everything works fine if I setup the KafkaProducerActor with a ByteArraySerializer for the value and explicitly use my ProtobufMessageSerializer to serialize the message before sending it to the producer actor.

Thanks! Best Regards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant