简体   繁体   English

找不到适用于kamon播放应用程序的application.conf资源

[英]application.conf resource not found for kamon play application

Having some trouble here with my play-akka application that I'm trying to monitor using Kamon.io. 我尝试使用Kamon.io监视的play-akka应用程序在此处遇到了一些问题。 I was having trouble with it telling me I'm not utilizing kamon.start() and after finding the work around javaOptions in Runtime := Seq("-Dkamon.auto-start=true"); 我在告诉我我没有利用kamon.start()并在运行时找到围绕javaOptions的工作后遇到麻烦:= Seq(“-Dkamon.auto-start = true”); I now find my self with a resource not found error for my application.conf file. 现在,对于我的application.conf文件,我发现自己出现资源未找到错误。

When I don't run aspectjweaver kamon throws a different error, but my application will work. 当我不运行AspectJweaver时,kamon会引发另一个错误,但是我的应用程序可以运行。 Here is the error I'm getting, if anyone could help it would greatly help me out! 这是我遇到的错误,如果有人可以帮忙,它将对我有很大帮助! Thanks guys! 多谢你们!

[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

Add a "me to" to the list. 在列表中添加“我到”。 It somehow changes the way how Play locates certain things. 它以某种方式改变了Play定位某些事物的方式。

It seems that this issue is solved in next kamon release (v.0.6.0). 在下一个kamon版本(v.0.6.0)中似乎解决了此问题。

There is a workaround though. 不过,有一种解决方法。 I found it here: https://groups.google.com/forum/#!msg/kamon-user/b9U7Z7EfQcM/7vQuHAKxDwAJ 我在这里找到它: https : //groups.google.com/forum/#!msg/kamon-user/b9U7Z7EfQcM/7vQuHAKxDwAJ

For Play 2.5 and Kamon 0.6.2, the following approach works. 对于Play 2.5和Kamon 0.6.2,可以使用以下方法。 You need to pass the application.conf path via system property, like this: 您需要通过系统属性传递application.conf路径,如下所示:

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

It's important to respect the paths. 尊重路径很重要。 In the example above, from my current project, the Play application is a project in multi-project SBT build, and therefore resides in a subdirectory called "webapp". 在上面的示例中,从我当前的项目来看,Play应用程序是多项目SBT构建中的一个项目,因此位于一个名为“ webapp”的子目录中。 If you're running a simple singe-project build, you'd call it like this: 如果您正在运行一个简单的singe-project构建,则可以这样称呼它:

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

I had a similar problem and found out at the end that I didn't provide Akka with the web context. 我遇到了类似的问题,最后发现我没有向Akka提供Web上下文。 In the controller, you have to make sure you pass the context when calling a web-dependent method. 在控制器中,必须确保在调用基于Web的方法时传递上下文。 Following is a java example: 以下是一个Java示例:

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

Without the Web context, no files can be located. 没有Web上下文,将找不到文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM