2015-11-03 67 views
0

在我嘗試使用Kamon.io監視我的play-akka應用程序時遇到了一些麻煩。我遇到了麻煩,告訴我我沒有使用kamon.start(),並在運行時找到javaOptions的工作後:= Seq(「 - Dkamon.auto-start = true」);我現在發現自己的資源未找到我的application.conf文件錯誤。未找到kamon play應用程序的application.conf資源

當我不運行aspectjweaver卡蒙拋出一個不同的錯誤,但我的應用程序將工作。這是我得到的錯誤,如果有人能幫助它,那將大大幫助我!多謝你們!

[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 
+0

您是否找到解決方案?我有同樣的問題。 – Renato

回答

0

添加「我到」列表。它以某種方式改變了Play如何定位特定事物的方式。

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 
0

我也有類似的問題,在我沒有提供阿卡與Web上下文最終發現了。 在控制器中,您必須確保在調用Web相關方法時傳遞上下文。以下是一個java示例:

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

沒有Web上下文,找不到文件。