我正在嘗試設置一個簡單的使用slick和postgres的2.5應用程序,但似乎無法通過錯誤。
我得到的錯誤是使用postgres驅動程序發揮漂亮的數據庫配置問題
[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>()
...
我有我的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}
}
}
而這些在我的依賴
"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"
如果我改變slick.dbs.default.driver
到slick.driver.PostgresDriver
以下(現在已被棄用)我得到
[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
...
我想把我的頭髮拉到這裏,找不到任何其他資源來看。有誰知道發生了什麼事?
也許'slick.dbs.default.driver =「slick.driver.PostgresDriver $」'而不是'Profile'? –
@ insan-e對不起,我有一個錯字,我嘗試過'slick.driver.PostgresDriver',我想我也嘗試過'slick.driver.PostgresDriver $'以及相同的結果,但讓我再試一次案件。 – kag0
@ insan-e whelp,回去嘗試'slick.jdbc.PostgresProfile $',現在可以使用了。如果你想提交答案,我會接受它,否則我會在稍後自我回答。 – kag0