Lagom and Kamon: Classloading errors

267 Views Asked by At

We are using Kamon to instrument all of our microservices, some of them use Lagom and other use akka-http.

Our Lagom microservices are using sbt-native-packager to create a zip file that, once unzipped, will run in our server. Whereas the akka-http ones are using sbt-pack.

We suspect that sbt-native-packager introduces some classloader magic.

The JVM is running with the aspectj-weaver agent correctly loaded,

setting JAVA_OPTS with -javaagent:/path/to/aspectjweaver-1.9.1.jar

We use scala 2.11.12

but in all of our Lagom microservices we get the following error

Exception in thread "main" java.lang.NoSuchMethodError: kamon.scala.instrumentation.FutureInstrumentation.aspectOf()Lkamon/scala/instrumentation/FutureInstrumentation;
    at scala.concurrent.impl.CallbackRunnable.<init>(Promise.scala:32)
    at scala.concurrent.impl.Promise$DefaultPromise.onComplete(Promise.scala:273)
    at akka.actor.ActorSystemImpl$TerminationCallbacks.<init>(ActorSystem.scala:1008)
    at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:800)
    at akka.actor.ActorSystem$.apply(ActorSystem.scala:246)
    at com.lightbend.lagom.scaladsl.server.ActorSystemProvider$.start(LagomApplicationLoader.scala:268)
    at com.lightbend.lagom.scaladsl.server.LagomApplication.actorSystem$lzycompute(LagomApplicationLoader.scala:239)
    at com.lightbend.lagom.scaladsl.server.LagomApplication.actorSystem(LagomApplicationLoader.scala:238)
    at play.api.BuiltInComponents$class.materializer(Application.scala:327)
    at play.api.BuiltInComponentsFromContext.materializer$lzycompute(ApplicationLoader.scala:122)
    at play.api.BuiltInComponentsFromContext.materializer(ApplicationLoader.scala:122)
    at com.lightbend.lagom.scaladsl.server.LagomServerComponents$class.lagomServerBuilder(LagomServer.scala:84)
    at com.lightbend.lagom.scaladsl.server.LagomApplication.lagomServerBuilder$lzycompute(LagomApplicationLoader.scala:222)
    at com.lightbend.lagom.scaladsl.server.LagomApplication.lagomServerBuilder(LagomApplicationLoader.scala:222)
    at com.lightbend.lagom.scaladsl.server.LagomApplication.<init>(LagomApplicationLoader.scala:244)
    at com.lightbend.lagom.scaladsl.server.LagomApplicationLoader.load(LagomApplicationLoader.scala:78)
    at play.core.server.ProdServerStart$.start(ProdServerStart.scala:51)
    at play.core.server.ProdServerStart$.main(ProdServerStart.scala:25)
    at play.core.server.ProdServerStart.main(ProdServerStart.scala)

And this is another slightly different stacktrace

java.lang.NoSuchMethodError: kamon.logback.instrumentation.AsyncAppenderInstrumentation.aspectOf()Lkamon/logback/instrumentation/AsyncAppenderInstrumentation;
        at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:47)
        at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:270)
        at ch.qos.logback.classic.Logger.callAppenders(Logger.java:257)
        at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:421)
        at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
        at ch.qos.logback.classic.Logger.info(Logger.java:579)
        at akka.event.slf4j.Slf4jLogger$$anonfun$receive$1.applyOrElse(Slf4jLogger.scala:92)
        at akka.actor.Actor$class.aroundReceive(Actor.scala:517)
        at akka.event.slf4j.Slf4jLogger.aroundReceive(Slf4jLogger.scala:54)
        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:590)
        at akka.actor.ActorCell.invoke(ActorCell.scala:559)
        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
        at akka.dispatch.Mailbox.run(Mailbox.scala:224)
        at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
        at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
        at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
        at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
        at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

Does anyone know why?

This is a project to show you the problem

https://github.com/ricsirigu/lagom-with-kamon

0

There are 0 best solutions below