1
我想在我的新应用程序中使用鸵鸟作为配置库(以前我有一个积极的经验使用它的运行时统计)。但是我无法使用自述文件中的代码片段工作。鸵鸟不能编译配置文件
这里是我的代码:
class Boot {
val bootLogger = LoggerFactory.getLogger(this.getClass)//slf4j
val confPath = Option(System.getenv("CONF_FILE"))
//living inside akka-kernel, so there is no access to real args
val args: Array[String] = confPath match {
case Some(path) => Array("-f", path)
case None => Array()
}
bootLogger.info(Class.forName("la.myproject.Config").toString)
val runtime = RuntimeEnvironment(this, args)
val server = runtime.loadRuntimeConfig[Server]()
try {
server.start()
} catch {
case e: Exception =>
bootLogger.error("Server start failed", e)
}
}
这是我的配置:
new la.myproject.Config {
//use the defaults
}
程序成功地加载配置类和失败与以下eror:
Error in config file: ../../src/main/conf/myproject.scala
com.twitter.util.Eval$CompilerException: Compiler exception error: line 3: not found: value la
new la.myproject.Config {
我想这是一个类加载问题。但是通过消息来源挖掘我不知道为什么会发生。鸵鸟以及Eval实用程序根本不会触及类加载。
进口la.myproject.Config 新配置{// 使用默认设置 } 有同样的效果。 – CheatEx 2012-02-16 10:39:53