After upgrading to 2.5 version of Play I'm facing this problem when I try to run project in production mode. It seems like in this version I need to initialize pool manually ScalikeJDBC: Connection pool is not yet initialized.(name:'default) I can't understand how can I do this. I've added this class:
import play.api.Logger
import scalikejdbc._
import scalikejdbc.config._
class DbInitializer {
DBs.setupAll()
Logger.debug("DB initialized")
}
and in my module mark it as EagerSingleton:
class GlobalModule extends AbstractModule {
def configure() = {
bind(classOf[DbInitializer]).asEagerSingleton()
}
}
Now when I run my project in production I see:
[info] application - Creating Pool for datasource 'default' [info] p.a.d.DefaultDBApi - Database [default] connected at jdbc:postgresql://localhost:5432/inetshop [debug] application - [debug] application - DB initialized Oops, cannot start the server. com.google.inject.CreationException: Unable to create injector, see the following errors:
1) Error injecting constructor, java.lang.IllegalStateException: Connection pool is not yet initialized.(name:'default) at controllers.Application.(Application.scala:20)
So my Initializer run successfully but still facing this problem. Need help to fix this.
DBs.setupAll()
does? – marcospereira