2012-02-15 35 views
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實用程序根本不會觸及類加載。

回答

0

在您的配置文件:

import la.myproject.Config 
+0

進口la.myproject.Config 新配置{// 使用默認設置 } 有同樣的效果。 – CheatEx 2012-02-16 10:39:53