我尝试使用光滑和postgres设置简单的2.5应用程序,但似乎无法通过错误。
我得到的错误是
[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
...
我想把头发拉到这里,找不到任何其他资源。有没有人知道发生了什么?
答案 0 :(得分:3)
果然,通过insan-e的推荐,我所要做的就是添加一个$
。因此slick.dbs.default.driver
应为"slick.jdbc.PostgresProfile$"
。