rusins
rusins

Reputation: 319

Play 2.5 + Slick application.conf configuration error with URL

In case anyone gets this weird error, which doesn't help explain what the problem is:

CreationException: Unable to create injector, see the following errors: 1) Error in custom provider, java.lang.IllegalStateException: when specifying driverClassName, jdbcUrl must also be specified while locating play.api.db.evolutions.ApplicationEvolutionsProvider at play.api.db.evolutions.EvolutionsModule.bindings(EvolutionsModule.scala:22): Binding(class play.api.db.evolutions.ApplicationEvolutions to ProviderConstructionTarget(class play.api.db.evolutions.ApplicationEvolutionsProvider) eagerly) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1) while locating play.api.db.evolutions.ApplicationEvolutions 1 error

What I found strange was that the error goes away if you remove

"com.typesafe.play" %% "play-slick-evolutions" % "2.0.0"

from your build.sbt file.

Upvotes: 0

Views: 487

Answers (1)

rusins
rusins

Reputation: 319

Anyway, the problem was that I had my application.conf file look like this:

slick.dbs.default.driver = "slick.driver.PostgresDriver$"
slick.dbs.default.db.driver = "org.postgresql.Driver"
slick.dbs.default.url = "jdbc:postgresql://localhost:5432/pusdienodb"
slick.dbs.default.user = "pusdieno"
slick.dbs.default.password = "password"

Turns out that both url, user and password also need the .db. part.

So your configuration should look something like this in the end:

slick.dbs.default.driver = "slick.driver.PostgresDriver$"
slick.dbs.default.db.driver = "org.postgresql.Driver"
slick.dbs.default.db.url = "jdbc:postgresql://localhost:5432/pusdienodb"
slick.dbs.default.db.user = "pusdieno"
slick.dbs.default.db.password = "password"

Upvotes: 2

Related Questions