Lagom和Kamon:类加载错误

时间:2018-08-03 11:05:06

标签: scala lagom kamon

我们正在使用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

0 个答案:

没有答案