Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

play slick database configuration issues with postgres driver

I'm trying to set up a simple play 2.5 application with slick and postgres, but can't seem to get past an error.
The error I'm getting is

[error] p.a.d.s.DefaultSlickApi - Failed to create Slick database config for key default.
slick.SlickException: Error getting instance of profile "slick.jdbc.PostgresProfile"
...
Caused by: java.lang.InstantiationException: slick.jdbc.PostgresProfile
...
Caused by: java.lang.NoSuchMethodException: slick.jdbc.PostgresProfile.<init>()
...

I've got the following in my application.conf

slick.dbs.default {
  driver = "slick.jdbc.PostgresProfile"
  db = {
    driver = "org.postgresql.Driver"

    user = postgres
    host = localhost
    port = 5432
    password = ""

    host = ${?EVENTUAL_DB_HOST}
    port = ${?EVENTUAL_DB_PORT}
    user = ${?EVENTUAL_DB_USER}
    password = ${?EVENTUAL_DB_PW}
    url = "jdbc:postgresql://"${slick.dbs.default.db.host}":"${slick.dbs.default.db.port}"/"${slick.dbs.default.db.user}
  }
}

and these in my dependencies

  "com.typesafe.play" %% "play-slick" % "2.1.0",
  "com.typesafe.slick" %% "slick-codegen" % "3.1.1",
  "com.github.tminglei" %% "slick-pg" % "0.15.0-RC", //"0.14.6",
  "org.postgresql" % "postgresql" % "42.0.0"

if I change slick.dbs.default.driver to slick.driver.PostgresDriver (which is now deprecated evidently) I get

[error] p.a.d.s.DefaultSlickApi - Failed to create Slick database config for key default.
slick.SlickException: Error getting instance of profile "slick.driver.PostgresDriver"
...
Caused by: java.lang.ClassNotFoundException: slick.driver.PostgresDriver
...

I'm about pulling my hair out here and can't find any other resources to look at. Does anyone have any idea what's going on?

like image 858
kag0 Avatar asked Mar 09 '23 08:03

kag0


1 Answers

Sure enough, by recommendation of insan-e, all I had to do was add a $. So slick.dbs.default.driver should be "slick.jdbc.PostgresProfile$".

like image 52
kag0 Avatar answered Mar 25 '23 09:03

kag0