2011-07-19 6 views
4

に私がしようとしているscalatra-sbt.g8に基づいて、次Scalate ResourceNotFoundException Scalatra

class FooWeb extends ScalatraServlet with ScalateSupport { 
    beforeAll { contentType = "text/html" } 
    get("/") { 
    templateEngine.layout("/WEB-INF/scalate/templates/hello-scalate.jade") 
    } 
} 

が、私は次の例外(ファイルが存在していても)取得しています - 任意の手掛かりを? _baseResource==null

Could not load resource: [/WEB-INF/scalate/templates/hello-scalate.jade]; are you sure it's within [null]? 

org.fusesource.scalate.util.ResourceNotFoundException: Could not load resource: [/WEB-INF/scalate/templates/hello-scalate.jade]; are you sure it's within [null]? 

FWIWは、最も内側の例外がorg.mortbay.jetty.handler.ContextHandler.getResourceライン1142から来ています。

答えて

5

スカラメーリングリストからの回答がありました。問題は、私は突堤サーバを始めていたということでした。

import org.mortbay.jetty.Server 
import org.mortbay.jetty.servlet.{Context,ServletHolder} 
val server = new Server(8080) 
val root = new Context(server, "/", Context.SESSIONS) 
root.addServlet(new ServletHolder(new FooWeb()), "/*") 
server.start() 

私はstart()前にこれを挿入するために必要な:

root.setResourceBase("src/main/webapp") 
関連する問題