2

我们正在使用 Kamon 来检测我们所有的微服务,其中一些使用 Lagom,另一些使用 akka-http。

我们的 Lagom 微服务正在使用 sbt-native-packager 创建一个 zip 文件,一旦解压缩,它将在我们的服务器中运行。而 akka-http 使用的是 sbt-pack。

我们怀疑 sbt-native-packager 引入了一些类加载器魔法。

JVM 在正确加载 aspectj-weaver 代理的情况下运行,

设置JAVA_OPTS-javaagent:/path/to/aspectjweaver-1.9.1.jar

我们使用 scala 2.11.12

但是在我们所有的 Lagom 微服务中,我们都会收到以下错误

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)

这是另一个略有不同的堆栈跟踪

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)

有谁知道为什么?

这是一个向您展示问题的项目

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

4

0 回答 0