0

我尝试使用 Kamon.io 监控的 play-akka 应用程序在这里遇到了一些问题。我在告诉我我没有使用 kamon.start() 并且在 Runtime 中找到有关 javaOptions 的工作后遇到了麻烦:= Seq("-Dkamon.auto-start=true"); 我现在发现自己的 application.conf 文件出现资源未找到错误。

当我不运行 aspectjweaver 时,kamon 会抛出一个不同的错误,但我的应用程序会工作。这是我遇到的错误,如果有人可以提供帮助,它将极大地帮助我!多谢你们!

[info]  Running Play application with Aspectj Weaver.
--- (Running the application, auto-reloading is enabled) ---

[WeavingURLClassLoader] warning javax.* types are not being woven because the we
aver option '-Xset:weaveJavaxPackages=true' has not been specified
com.typesafe.config.ConfigException$IO: application.conf: java.io.IOException: r
esource not found on classpath: application.conf
        at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:188)
        at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:174)
        at com.typesafe.config.impl.Parseable.parse(Parseable.java:299)
        at com.typesafe.config.ConfigFactory.parseResources(ConfigFactory.java:1
002)
        at com.typesafe.config.ConfigFactory.parseResources(ConfigFactory.java:9
30)
        at com.typesafe.config.ConfigFactory.parseApplicationConfig(ConfigFactor
y.java:251)
        at com.typesafe.config.ConfigFactory.defaultApplication(ConfigFactory.ja
va:519)
        at com.typesafe.config.ConfigFactory$1.call(ConfigFactory.java:305)
        at com.typesafe.config.ConfigFactory$1.call(ConfigFactory.java:302)
        at com.typesafe.config.impl.ConfigImpl$LoaderCache.getOrElseUpdate(Confi
gImpl.java:65)
        at com.typesafe.config.impl.ConfigImpl.computeCachedConfig(ConfigImpl.ja
va:92)
        at com.typesafe.config.ConfigFactory.load(ConfigFactory.java:302)
        at com.typesafe.config.ConfigFactory.load(ConfigFactory.java:278)
        at kamon.Kamon$.ifStarted(Kamon.scala:95)
        at kamon.Kamon$.metrics(Kamon.scala:78)
        at akka.kamon.instrumentation.LookupDataAware$LookupData$.apply$default$
3(DispatcherInstrumentation.scala:184)
        at akka.kamon.instrumentation.DispatcherInstrumentation.aroundDispatcher
sLookup(DispatcherInstrumentation.scala:83)
        at akka.dispatch.Dispatchers.lookup(Dispatchers.scala:81)
        at akka.dispatch.Dispatchers.defaultGlobalDispatcher(Dispatchers.scala:7
1)
        at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:599)
        at akka.actor.ActorSystem$.apply(ActorSystem.scala:142)
        at akka.actor.ActorSystem$.apply(ActorSystem.scala:126)
        at play.api.libs.concurrent.ActorSystemProvider$.start(Akka.scala:291)
        at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerSta
rt.scala:205)
        at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerSta
rt.scala:61)
        at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
        at play.core.server.DevServerStart$.mainDev(DevServerStart.scala:60)
        at play.core.server.DevServerStart$.mainDevHttpMode(DevServerStart.scala
:50)
        at play.core.server.DevServerStart.mainDevHttpMode(DevServerStart.scala)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at play.runsupport.Reloader$.startDevMode(Reloader.scala:207)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.devModeServer$lzycompute$1(PlayRun.scala:73)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.play$sbt$run$PlayRun$$anonfun$$anonfun$$anonfun$$devModeServer$1(PlayRu
n.scala:73)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.apply(PlayRun.scala:99)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.apply(PlayRun.scala:52)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
Caused by: java.io.IOException: resource not found on classpath: application.con
f
        at com.typesafe.config.impl.Parseable$ParseableResources.rawParseValue(P
arseable.java:735)
        at com.typesafe.config.impl.Parseable$ParseableResources.rawParseValue(P
arseable.java:710)
        at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:180)
        at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:174)
        at com.typesafe.config.impl.Parseable.parse(Parseable.java:299)
        at com.typesafe.config.ConfigFactory.parseResources(ConfigFactory.java:1
002)
        at com.typesafe.config.ConfigFactory.parseResources(ConfigFactory.java:9
30)
        at com.typesafe.config.ConfigFactory.parseApplicationConfig(ConfigFactor
y.java:251)
        at com.typesafe.config.ConfigFactory.defaultApplication(ConfigFactory.ja
va:519)
        at com.typesafe.config.ConfigFactory$1.call(ConfigFactory.java:305)
        at com.typesafe.config.ConfigFactory$1.call(ConfigFactory.java:302)
        at com.typesafe.config.impl.ConfigImpl$LoaderCache.getOrElseUpdate(Confi
gImpl.java:65)
        at com.typesafe.config.impl.ConfigImpl.computeCachedConfig(ConfigImpl.ja
va:92)
        at com.typesafe.config.ConfigFactory.load(ConfigFactory.java:302)
        at com.typesafe.config.ConfigFactory.load(ConfigFactory.java:278)
        at kamon.Kamon$.ifStarted(Kamon.scala:95)
        at kamon.Kamon$.metrics(Kamon.scala:78)
        at akka.kamon.instrumentation.LookupDataAware$LookupData$.apply$default$
3(DispatcherInstrumentation.scala:184)
        at akka.kamon.instrumentation.DispatcherInstrumentation.aroundDispatcher
sLookup(DispatcherInstrumentation.scala:83)
        at akka.dispatch.Dispatchers.lookup(Dispatchers.scala:81)
        at akka.dispatch.Dispatchers.defaultGlobalDispatcher(Dispatchers.scala:7
1)
        at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:599)
        at akka.actor.ActorSystem$.apply(ActorSystem.scala:142)
        at akka.actor.ActorSystem$.apply(ActorSystem.scala:126)
        at play.api.libs.concurrent.ActorSystemProvider$.start(Akka.scala:291)
        at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerSta
rt.scala:205)
        at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerSta
rt.scala:61)
        at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
        at play.core.server.DevServerStart$.mainDev(DevServerStart.scala:60)
        at play.core.server.DevServerStart$.mainDevHttpMode(DevServerStart.scala
:50)
        at play.core.server.DevServerStart.mainDevHttpMode(DevServerStart.scala)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at play.runsupport.Reloader$.startDevMode(Reloader.scala:207)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.devModeServer$lzycompute$1(PlayRun.scala:73)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.play$sbt$run$PlayRun$$anonfun$$anonfun$$anonfun$$devModeServer$1(PlayRu
n.scala:73)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.apply(PlayRun.scala:99)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.apply(PlayRun.scala:52)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
[trace] Stack trace suppressed: run last aspectj-runner:run for the full output.

[error] (aspectj-runner:run) java.lang.reflect.InvocationTargetException
[error] Total time: 13 s, completed 3-Nov-2015 3:18:25 PM
4

4 回答 4

0

对于 Play 2.5 和 Kamon 0.6.2,以下方法有效。您需要application.conf通过系统属性传递路径,如下所示:

sbt "webapp/aspectj-runner:run" -Dconfig.file=webapp/conf/application.conf

尊重路径很重要。在上面的示例中,在我当前的项目中,Play 应用程序是多项目 SBT 构建中的项目,因此位于名为“webapp”的子目录中。如果您正在运行一个简单的单一项目构建,您可以这样称呼它:

sbt "aspectj-runner:run" -Dconfig.file=conf/application.conf
于 2016-10-05T08:45:52.397 回答
0

我遇到了类似的问题,最后发现我没有为 Akka 提供网络上下文。在控制器中,您必须确保在调用与 Web 相关的方法时传递上下文。以下是一个java示例:

CompletableFuture.supplyAsync(() -> {
}, MyHttpExecutionContext.current());

如果没有 Web 上下文,就无法找到任何文件。

于 2017-07-13T12:05:11.287 回答
0

看来这个问题在下一个 kamon 版本(v.0.6.0)中得到了解决。

不过有一个解决方法。我在这里找到它: https ://groups.google.com/forum/#!msg/kamon-user/b9U7Z7EfQcM/7vQuHAKxDwAJ

于 2016-03-02T13:46:13.027 回答
0

将“我”添加到列表中。它以某种方式改变了 Play 定位某些事物的方式。

于 2015-11-25T12:33:42.723 回答