After upgrade to Play 2.5.0: java.lang.RuntimeException: There is no started application

Viewed 3020

I tried to update my app to Play 2.5.0. All tests with OneAppPerTest don't run anymore. The app does not run anymore either. I can start the app with sbt run, but my first request brings the same error message:

java.lang.RuntimeException: There is no started application.  

I do have a mix with DI and traits and it works properly in play 2.4.6. I have no clue where to search now. Does anybody has the same problems?

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)

Here is my DAOSlick Trait, which is using the deprecated 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._
}

Here is the head of "MyController":

@Singleton
class WebsocketController @Inject() (redis: RedisService, notificationService: NotificationService) extends SecuredController with SomeService {

Both, the injected Service NotificationService and the Trait SomeService are extending the DAOSlick Trait.

Can anybody give me a hint, how to change the dependency in my DAOSlick to Play.current, please?

1 Answers
Related