I'm in troubles, I don't know why I can't connect to the database, all was ok.
play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[SQLTimeoutException: Timeout after 60001ms of waiting for a connection.]]
at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:293)
at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:220)
at play.api.GlobalSettings$class.onError(GlobalSettings.scala:160)
at play.api.DefaultGlobal$.onError(GlobalSettings.scala:188)
at play.api.http.GlobalSettingsHttpErrorHandler.onServerError(HttpErrorHandler.scala:100)
at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:100)
at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:99)
at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:346)
at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:345)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
Caused by: java.sql.SQLTimeoutException: Timeout after 60001ms 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 slick.jdbc.JdbcBackend$BaseSession.conn$lzycompute(JdbcBackend.scala:415)
at slick.jdbc.JdbcBackend$BaseSession.conn(JdbcBackend.scala:414)
at slick.jdbc.JdbcBackend$SessionDef$class.prepareStatement(JdbcBackend.scala:297)
at slick.jdbc.JdbcBackend$BaseSession.prepareStatement(JdbcBackend.scala:407)
at slick.jdbc.StatementInvoker.results(StatementInvoker.scala:33)
at slick.jdbc.StatementInvoker.iteratorTo(StatementInvoker.scala:22)
Caused by: java.sql.SQLException: JDBC4 Connection.isValid() method not supported, connection test query must be configured
at com.zaxxer.hikari.pool.BaseHikariPool.addConnection(BaseHikariPool.java:441)
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)
... 3 common frames omitted
My application.conf
slick.dbs.default.db.connectionTimeout=60000
slick.dbs.default.driver="utils.db.TetraoPostgresDriver$"
slick.dbs.default.db.driver="org.postgresql.Driver"
slick.dbs.default.db.url="jdbc:postgresql://localhost:5432 /templatesite_db"
slick.dbs.default.db.user="marcus"
slick.dbs.default.db.password="123"
play.http.parser.maxDiskBuffer=100MB
parsers.anyContent.maxLength=100MB
build.sbt
lazy val root = (project in file("."))
.settings(commonSettings: _*)
.settings(routesGenerator := InjectedRoutesGenerator)
.settings(
libraryDependencies += "com.typesafe.slick" %% "slick" % "3.1.1",
libraryDependencies += "com.typesafe.slick" %% "slick-codegen" % "3.1.1",
libraryDependencies += "com.github.tminglei" %% "slick-pg" % "0.14.1",
libraryDependencies += "com.github.tminglei" %% "slick-pg_date2" % "0.14.1",
libraryDependencies += "com.typesafe.play" %% "play-slick" % "2.0.2",
libraryDependencies += "jp.t2v" %% "play2-auth" % "0.14.2",
libraryDependencies += play.sbt.Play.autoImport.cache,
libraryDependencies += "com.github.t3hnar" %% "scala-bcrypt" % "2.6",
libraryDependencies += "org.webjars" %% "webjars-play" % "2.5.0",
libraryDependencies += "org.webjars" % "foundation" % "6.2.3"
).enablePlugins(PlayScala)
resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
I think it might be that the HikariCP Module is looking for a connectionTestQuery and not finding it (and throwing the error). Try adding the following to application.conf:
slick.dbs.default.db.connectionTestQuery="/*ping*/ select 1" // or whatever
Answer from: Caused by: java.sql.SQLException: JDBC4 Connection.isValid() method not supported