我試圖將我的應用程序更新爲Play 2.5.0。所有測試OneAppPerTest
不再運行。該應用程序也不再運行。我可以sbt run
啓動應用程序,但我的第一個請求帶來了同樣的錯誤消息:升級到Play 2.5.0之後:java.lang.RuntimeException:沒有啓動應用程序
java.lang.RuntimeException: There is no started application.
我確實有DI和性狀的結構和它工作正常在遊戲2.4.6。 我不知道現在在哪裏搜索。有人有同樣的問題嗎?
Error injecting constructor, java.lang.RuntimeException: There is no started application
at com.myproject.controllers.MyController.<init>(MyController.scala:30)
at com.myproject.controllers.MyController.class(MyController.scala:30)
while locating com.myproject.controllers.MyController
for parameter 7 at router.Routes.<init>(Routes.scala:79)
while locating router.Routes
while locating play.api.inject.RoutesProvider
while locating play.api.routing.Router
for parameter 0 at play.api.http.JavaCompatibleHttpRequestHandler.<init>(HttpRequestHandler.scala:200)
while locating play.api.http.JavaCompatibleHttpRequestHandler
while locating play.api.http.HttpRequestHandler
for parameter 4 at play.api.DefaultApplication.<init>(Application.scala:220)
at play.api.DefaultApplication.class(Application.scala:220)
while locating play.api.DefaultApplication
while locating play.api.Application
Caused by: java.lang.RuntimeException: There is no started application
at scala.sys.package$.error(package.scala:27)
at play.api.Play$$anonfun$current$1.apply(Play.scala:86)
at play.api.Play$$anonfun$current$1.apply(Play.scala:86)
at scala.Option.getOrElse(Option.scala:121)
at play.api.Play$.current(Play.scala:86)
at com.myproject.model.dao.DAOSlick$class.dbConfig(DAOSlick.scala:11)
at com.myproject.controllers.MyController.dbConfig$lzycompute(MyController.scala:30)
at com.myproject.controllers.MyController.dbConfig(MyController.scala:30)
at play.api.db.slick.HasDatabaseConfig$class.driver(DatabaseConfigProvider.scala:142)
at com.myproject.controllers.MyController.driver$lzycompute(MyController.scala:30)
at com.myproject.controllers.MyController.driver(MyController.scala:30)
at com.myproject.controllers.MyController.driver(MyController.scala:30)
at com.myproject.model.dao.JavaTimeMapper$class.$init$(JavaTimeMapper.scala:20)
at com.myproject.controllers.MyController.<init>(MyController.scala:30)
at com.myproject.controllers.MyController$$FastClassByGuice$$b68ea36a.newInstance(<generated>)
at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
這裏是我的DAOSlick特質,這是使用過時Play.current
:
import play.api.Play
import play.api.db.slick.DatabaseConfigProvider
import slick.driver.JdbcProfile
trait DAOSlick {
protected lazy val dbConfig = DatabaseConfigProvider.get[JdbcProfile]("default")(Play.current) // this is line 11, where it fails
protected val driver: JdbcProfile
import driver.api._
}
這裏是 「myController的頭」:
@Singleton
class WebsocketController @Inject() (redis: RedisService, notificationService: NotificationService) extends SecuredController with SomeService {
兩個,注入的服務NotificationService
和特性SomeService
正在擴展DAOSlick特性。
任何人都可以給我一個提示,如何將我的DAOSlick
中的依賴項更改爲Play.current
?
你有沒有檢查遷移指南? https://playframework.com/documentation/2.5.x/Migration25 – pedrorijo91
您是否還將Play-slick升級到版本2.0.0? – marcospereira
是的。升級後的遊戲光滑度爲2.0.0。是的,檢查了遷移指南。我改變的唯一的東西是logback配置文件。 – gun