Play 2 找不到postgres驱动

Play 2 postgres driver not found

我正在 IntelliJ 中做一个 Scala Play 2 项目,由于某种原因,播放框架无法识别 Postgres 驱动程序。

Configuration error[Cannot connect to database [default]]
Caused by: play.api.Configuration$$anon: Configuration error[Driver not found: [org.postgresql.jdbc.Driver}]]

我的build.sbt更新了:

libraryDependencies += "org.postgresql" % "postgresql" % "9.4-1206-jdbc42"

我的 application.conf 拥有所有正确的东西:

db.default.driver="org.postgresql.jdbc.Driver"
db.default.url="jdbc:postgresql://theurl:5439/mydb"
db.default.user="me"
db.default.password="thepassword"

请注意,我已经分别验证了用户名、密码和连接 url - 它们有效。

我尝试过的事情:(1) 手动下载潜水员并将它们放在我的 lib 目录中,(2) restarting/rebuilding 项目,(3) 更改驱动程序版本,以及 ( 4) 实施类似问题 的解决方案,其中涉及将以下行添加到我的 application.conf:

db.default.hikaricp.connectionTestQuery = "SELECT 1"

None 这些东西都起作用了,甚至改变了错误信息。我该如何解决这个问题?

您提供的驱动程序 ("org.postgresql.jdbc.Driver") 不正确。正确的是 org.postgresql.Driver.

详情

根据 Play Docs here 您需要以下配置:

# application.conf
db.default.driver=org.postgresql.Driver
db.default.url="....."