与postgres和光滑连接的NPE

时间:2018-01-17 09:20:45

标签: postgresql playframework slick hikaricp

我无法连接我的postgres数据库(AWS RDS),我不知道如何解决这个问题:

Caused by: java.sql.SQLTimeoutException: Timeout after 1001ms of waiting for a connection.
        at com.zaxxer.hikari.pool.BaseHikariPool.getConnection(BaseHikariPool.java:227)
        at com.zaxxer.hikari.pool.BaseHikariPool.getConnection(BaseHikariPool.java:182)
        at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:93)
        at slick.jdbc.hikaricp.HikariCPJdbcDataSource.createConnection(HikariCPJdbcDataSource.scala:12)
        at play.api.db.slick.evolutions.internal.DBApiAdapter$DatabaseAdapter.getConnection(DBApiAdapter.scala:57)
        at play.api.db.slick.evolutions.internal.DBApiAdapter$DatabaseAdapter.getConnection(DBApiAdapter.scala:60)
        at play.api.db.evolutions.DatabaseEvolutions.databaseEvolutions(EvolutionsApi.scala:124)
        at play.api.db.evolutions.DatabaseEvolutions.scripts(EvolutionsApi.scala:102)
        at play.api.db.evolutions.DatabaseEvolutions.scripts(EvolutionsApi.scala:117)
        at play.api.db.evolutions.DefaultEvolutionsApi.scripts(EvolutionsApi.scala:82)
Caused by: java.lang.NullPointerException: null
        at com.zaxxer.hikari.pool.BaseHikariPool.addConnection(BaseHikariPool.java:446)
        at com.zaxxer.hikari.pool.BaseHikariPool$1.run(BaseHikariPool.java:413)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

我的联系似乎正确:

slick.dbs.default.driver = "slick.driver.PostgresDriver$"
slick.dbs.default.db.driver = "org.postgresql.Driver"
slick.dbs.default.db.url = "jdbc:postgres://<url>"
slick.dbs.default.db.user = ""
slick.dbs.default.db.password = ""
slick.dbs.default.db.connectionTestQuery = "select 1"

我尝试使用此项目:https://github.com/vahana-team/play-slick-postgres

你有什么想法吗?

1 个答案:

答案 0 :(得分:0)

这只是一个配置问题:url不应该是“jdbc:postgres://”而是“jdbc:postgresql://”!