Scala播放制作开始不起作用(资源文件夹不可用)

时间:2016-04-02 01:54:15

标签: scala playframework

我可以使用

在开发模式下运行游戏
Application

然而,当我尝试通过

部署我的代码时
./activator run

我在尝试访问主页时遇到错误

./activator start

详细

 [info] play - Application started (Prod)
 [info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
 [error] application - 

! @6pikee0l8 - Internal server error, for (GET) [/] ->

play.api.Application$$anon$1: Execution exception[[FileNotFoundException: /Users/vikashkumar/Documents/example/target/universal/stage/public/html/index.html (No such file or directory)]]
    at play.api.Application$class.handleError(Application.scala:296) ~[com.typesafe.play.play_2.10-2.3.9.jar:2.3.9]
    at play.api.DefaultApplication.handleError(Application.scala:402) [com.typesafe.play.play_2.10-2.3.9.jar:2.3.9]
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:205) [com.typesafe.play.play_2.10-2.3.9.jar:2.3.9]
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:202) [com.typesafe.play.play_2.10-2.3.9.jar:2.3.9]
    at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:33) [org.scala-lang.scala-library-2.10.5.jar:na]
Caused by: java.io.FileNotFoundException: /Users/vikashkumar/Documents/example/target/universal/stage/public/html/index.html (No such file or directory)
    at java.io.FileInputStream.open0(Native Method) ~[na:1.8.0_45]
    at java.io.FileInputStream.open(FileInputStream.java:195) ~[na:1.8.0_45]
    at java.io.FileInputStream.<init>(FileInputStream.java:138) ~[na:1.8.0_45]
    at scala.io.Source$.fromFile(Source.scala:90) ~[org.scala-lang.scala-library-2.10.5.jar:na]
    at scala.io.Source$.fromFile(Source.scala:75) ~[org.scala-lang.scala-library-2.10.5.jar:na]

Plugin.sbt

   scalaVersion := "2.11.6"

还有一点是,我使用放置在public / html / index.html的index.html作为索引页而不是使用播放模板。

看起来资产(插件/ html,css等)文件夹未在生产中公开

提前致谢!

1 个答案:

答案 0 :(得分:0)

sbt应该能够运行您的代码。你为什么要使用激活剂?

使用sbt run启动您的应用,而不是activator start黑匣子