Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlaySlick with Postgres [info] play.api.UnexpectedException: Unexpected exception[SQLTimeoutException: Timeout after 30004ms of waiting for a connection.] #336

Closed
ngoctranfire opened this issue Nov 4, 2015 · 9 comments

Comments

@ngoctranfire
Copy link

I keep getting this error. Can you tell me why this happens. It happens specifically when I have this type of configuration

slick.dbs.default.driver="slick.driver.PostgresDriver$"
slick.dbs.default.db.driver="org.postgresql.Driver"
slick.dbs.default.db.dataSourceClass = "slick.jdbc.DatabaseUrlDataSource"
slick.dbs.default.db.url="jdbc:postgresql://localhost:5432/play_blog_sample"
slick.dbs.default.db.connectionTimeout = 30s
slick.dbs.default.db.user="my_user"
slick.dbs.default.db.password="new_password"

If I include:
slick.dbs.default.db.connectionPool = "disabled", it leads to the following error:

SQLException: Required parameter "url" missing in DriverDataSource

Can you help me figure out why this is happening T_T I can include the stack trace if u need it.

@dotta
Copy link
Contributor

dotta commented Nov 10, 2015

Hi @ngoctranfire, usage questions should be asked on the playframework-user mailing list. The issue tracker is for confirmed issues.

The likely reason why you are getting a SQLTimeoutException is because there aren't any connection available. The usual reason for this is that you are leaking connections, but this should be hard now with Slick 3+. However, to tell exactly one should have a look at your code. You may find the following discussion useful for debugging the problem brettwooldridge/HikariCP#104

If I include:
slick.dbs.default.db.connectionPool = "disabled", it leads to the following error:

SQLException: Required parameter "url" missing in DriverDataSource

That seems like a bug. Is this happening with the latest play-slick 1.1.1? I'm asking because it seems somewhat similar to #324, and the linked issue was fixed in 1.1.1. If you can reproduce the issue with 1.1.1, could you please open a ticket for it. Thanks!

Cheers,
Mirco

@dotta
Copy link
Contributor

dotta commented Nov 10, 2015

As explained in my comment (first paragraph), I'm closing this ticket because a SQLTimeoutException is likely a usage mistake.

@schmitch
Copy link
Contributor

@dotta I don't think this is a usage mistake. I had a small project with play-slick and slick (latest), however I got a timeout on windows and only on windows when using postgres. also after downgrading i had another problem that he couldn't find the correct connection params (other configs worked). however after removing play-slick i used anorm and it worked flawless.
i'm not sure if thats a bug in play-slick or slick itself. however i will investigate further and raise a ticket if I tracked it down. However its really hard to find since we aren't using windows that much.

@dotta
Copy link
Contributor

dotta commented Nov 11, 2015

@schmitch Interesting, and thanks for chiming in. I'd really appreciate if you could investigate further. If you happen to find the time, please have a look at brettwooldridge/HikariCP#104, as it contains a few tips on how to increase debugging. In fact, if the issue is not due to a wrong usage, then it may be something linked to way hikaricp work. One way to check if hikaricp is involved would be to set slick.dbs.default.db.connectionPool = "disabled", maybe that's something you could quickly check? (if you do it, please make sure to use play-slick v1.1.1).

@schmitch
Copy link
Contributor

@dotta somehow my error is quite different and as said only on windows i'm running in prod mode (not tested dev mode)

Stacktrace with slick.dbs.default.db.connectionPool = "disabled"

play.api.UnexpectedException: Unexpected exception[PSQLException: Der Verbindungsversuch schlug fehl.]
        at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:261) ~[com.typesafe.play.play_2.11-2.4.3.jar:2.4.3]
        at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:191) ~[com.typesafe.play.play_2.11-2.4.3.jar:2.4.3]
        at play.api.GlobalSettings$class.onError(GlobalSettings.scala:179) [com.typesafe.play.play_2.11-2.4.3.jar:2.4.3]
        at play.api.DefaultGlobal$.onError(GlobalSettings.scala:212) [com.typesafe.play.play_2.11-2.4.3.jar:2.4.3]
        at play.api.http.GlobalSettingsHttpErrorHandler.onServerError(HttpErrorHandler.scala:94) [com.typesafe.play.play_2.11-2.4.3.jar:2.4.3]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$9$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:158) [com.typesafe.play.play-netty-server_2.11-2.4.3.jar:2.4.3]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$9$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:155) [com.typesafe.play.play-netty-server_2.11-2.4.3.jar:2.4.3]
        at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.util.Failure$$anonfun$recover$1.apply(Try.scala:215) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.util.Try$.apply(Try.scala:191) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.util.Failure.recover(Try.scala:215) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.Future$$anonfun$recover$1.apply(Future.scala:324) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.Future$$anonfun$recover$1.apply(Future.scala:324) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32) [org.scala-lang.scala-library-2.11.6.jar:na]
        at play.api.libs.iteratee.Execution$trampoline$.executeScheduled(Execution.scala:109) [com.typesafe.play.play-iteratees_2.11-2.4.3.jar:2.4.3]
        at play.api.libs.iteratee.Execution$trampoline$.execute(Execution.scala:71) [com.typesafe.play.play-iteratees_2.11-2.4.3.jar:2.4.3]
        at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:40) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:248) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.Promise$class.complete(Promise.scala:55) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:153) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32) [org.scala-lang.scala-library-2.11.6.jar:na]
        at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55) [com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
        at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:91) [com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
        at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91) [com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
        at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91) [com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
        at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72) [org.scala-lang.scala-library-2.11.6.jar:na]
        at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:90) [com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
        at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40) [com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
        at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397) [com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
        at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [org.scala-lang.scala-library-2.11.6.jar:na]
Caused by: org.postgresql.util.PSQLException: Der Verbindungsversuch schlug fehl.
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:257) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:149) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:35) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:47) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.jdbc42.AbstractJdbc42Connection.<init>(AbstractJdbc42Connection.java:21) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.jdbc42.Jdbc42Connection.<init>(Jdbc42Connection.java:28) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.Driver.makeConnection(Driver.java:415) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.Driver.connect(Driver.java:282) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at slick.jdbc.DriverDataSource.getConnection(DriverDataSource.scala:98) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.DataSourceJdbcDataSource.createConnection(JdbcDataSource.scala:64) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.JdbcBackend$BaseSession.conn$lzycompute(JdbcBackend.scala:415) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.JdbcBackend$BaseSession.conn(JdbcBackend.scala:414) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.JdbcBackend$SessionDef$class.prepareStatement(JdbcBackend.scala:297) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.JdbcBackend$BaseSession.prepareStatement(JdbcBackend.scala:407) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.StatementInvoker.results(StatementInvoker.scala:33) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.StatementInvoker.iteratorTo(StatementInvoker.scala:22) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.Invoker$class.foreach(Invoker.scala:48) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.StatementInvoker.foreach(StatementInvoker.scala:16) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.StreamingInvokerAction$class.run(StreamingInvokerAction.scala:22) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.SQLActionBuilder$$anon$1.run(StaticQuery.scala:100) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.SQLActionBuilder$$anon$1.run(StaticQuery.scala:100) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.backend.DatabaseComponent$DatabaseDef$$anon$2.liftedTree1$1(DatabaseComponent.scala:237) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.backend.DatabaseComponent$DatabaseDef$$anon$2.run(DatabaseComponent.scala:237) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:1.8.0_65]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:1.8.0_65]
        at java.lang.Thread.run(Unknown Source) ~[na:1.8.0_65]
Caused by: java.io.IOException: Ung³ltige UTF-8-Sequenz: das erste Byte ist 11111xxx: 252
        at org.postgresql.core.UTF8Encoding.decode(UTF8Encoding.java:125) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.core.PGStream.ReceiveString(PGStream.java:327) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:424) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:203) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        ... 27 common frames omitted

Stacktrace without

[info] - play.api.Play - Application started (Prod)
[info] - play.core.server.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
[error] - application -

! @6o50g3d9o - Internal server error, for (GET) [/] ->

play.api.UnexpectedException: Unexpected exception[SQLTimeoutException: Timeout after 1017ms of waiting for a connection.]
        at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:261) ~[com.typesafe.play.play_2.11-2.4.3.jar:2.4.3]
        at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:191) ~[com.typesafe.play.play_2.11-2.4.3.jar:2.4.3]
        at play.api.GlobalSettings$class.onError(GlobalSettings.scala:179) [com.typesafe.play.play_2.11-2.4.3.jar:2.4.3]
        at play.api.DefaultGlobal$.onError(GlobalSettings.scala:212) [com.typesafe.play.play_2.11-2.4.3.jar:2.4.3]
        at play.api.http.GlobalSettingsHttpErrorHandler.onServerError(HttpErrorHandler.scala:94) [com.typesafe.play.play_2.11-2.4.3.jar:2.4.3]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$9$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:158) [com.typesafe.play.play-netty-server_2.11-2.4.3.jar:2.4.3]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$9$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:155) [com.typesafe.play.play-netty-server_2.11-2.4.3.jar:2.4.3]
        at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.util.Failure$$anonfun$recover$1.apply(Try.scala:215) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.util.Try$.apply(Try.scala:191) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.util.Failure.recover(Try.scala:215) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.Future$$anonfun$recover$1.apply(Future.scala:324) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.Future$$anonfun$recover$1.apply(Future.scala:324) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32) [org.scala-lang.scala-library-2.11.6.jar:na]
        at play.api.libs.iteratee.Execution$trampoline$.executeScheduled(Execution.scala:109) [com.typesafe.play.play-iteratees_2.11-2.4.3.jar:2.4.3]
        at play.api.libs.iteratee.Execution$trampoline$.execute(Execution.scala:71) [com.typesafe.play.play-iteratees_2.11-2.4.3.jar:2.4.3]
        at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:40) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:248) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.Promise$class.complete(Promise.scala:55) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:153) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32) [org.scala-lang.scala-library-2.11.6.jar:na]
        at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55) [com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
        at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:91) [com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
        at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91) [com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
        at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91) [com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
        at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72) [org.scala-lang.scala-library-2.11.6.jar:na]
        at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:90) [com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
        at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40) [com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
        at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397) [com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
        at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [org.scala-lang.scala-library-2.11.6.jar:na]
        at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [org.scala-lang.scala-library-2.11.6.jar:na]
Caused by: java.sql.SQLTimeoutException: Timeout after 1017ms of waiting for a connection.
        at com.zaxxer.hikari.pool.BaseHikariPool.getConnection(BaseHikariPool.java:227) ~[com.zaxxer.HikariCP-2.3.7.jar:na]
        at com.zaxxer.hikari.pool.BaseHikariPool.getConnection(BaseHikariPool.java:182) ~[com.zaxxer.HikariCP-2.3.7.jar:na]
        at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:93) ~[com.zaxxer.HikariCP-2.3.7.jar:na]
        at slick.jdbc.hikaricp.HikariCPJdbcDataSource.createConnection(HikariCPJdbcDataSource.scala:12) ~[com.typesafe.slick.slick-hikaricp_2.11-3.1.0.jar:na]
        at slick.jdbc.JdbcBackend$BaseSession.conn$lzycompute(JdbcBackend.scala:415) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.JdbcBackend$BaseSession.conn(JdbcBackend.scala:414) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.JdbcBackend$SessionDef$class.prepareStatement(JdbcBackend.scala:297) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.JdbcBackend$BaseSession.prepareStatement(JdbcBackend.scala:407) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.StatementInvoker.results(StatementInvoker.scala:33) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.StatementInvoker.iteratorTo(StatementInvoker.scala:22) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.Invoker$class.foreach(Invoker.scala:48) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.StatementInvoker.foreach(StatementInvoker.scala:16) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.StreamingInvokerAction$class.run(StreamingInvokerAction.scala:22) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.SQLActionBuilder$$anon$1.run(StaticQuery.scala:100) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.jdbc.SQLActionBuilder$$anon$1.run(StaticQuery.scala:100) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.backend.DatabaseComponent$DatabaseDef$$anon$2.liftedTree1$1(DatabaseComponent.scala:237) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at slick.backend.DatabaseComponent$DatabaseDef$$anon$2.run(DatabaseComponent.scala:237) ~[com.typesafe.slick.slick_2.11-3.1.0.jar:na]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:1.8.0_65]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:1.8.0_65]
        at java.lang.Thread.run(Unknown Source) ~[na:1.8.0_65]
Caused by: org.postgresql.util.PSQLException: Der Verbindungsversuch schlug fehl.
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:257) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:149) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:35) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:47) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.jdbc42.AbstractJdbc42Connection.<init>(AbstractJdbc42Connection.java:21) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.jdbc42.Jdbc42Connection.<init>(Jdbc42Connection.java:28) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.Driver.makeConnection(Driver.java:415) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.Driver.connect(Driver.java:282) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:92) ~[com.zaxxer.HikariCP-2.3.7.jar:na]
        at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:98) ~[com.zaxxer.HikariCP-2.3.7.jar:na]
        at com.zaxxer.hikari.pool.BaseHikariPool.addConnection(BaseHikariPool.java:438) ~[com.zaxxer.HikariCP-2.3.7.jar:na]
        at com.zaxxer.hikari.pool.BaseHikariPool$1.run(BaseHikariPool.java:413) ~[com.zaxxer.HikariCP-2.3.7.jar:na]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[na:1.8.0_65]
        at java.util.concurrent.FutureTask.run(Unknown Source) ~[na:1.8.0_65]
        ... 3 common frames omitted
Caused by: java.io.IOException: Ung³ltige UTF-8-Sequenz: das erste Byte ist 11111xxx: 252
        at org.postgresql.core.UTF8Encoding.decode(UTF8Encoding.java:125) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.core.PGStream.ReceiveString(PGStream.java:327) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:424) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:203) ~[org.postgresql.postgresql-9.4-1205-jdbc42.jar:9.4]
        ... 18 common frames omitted

Also dropping postgres version to 9.3 things getting other errors, I also tried jdbc42, jdbc41 and jdbc4 (never tried jdbc3)

Sorry I just figured out that when I use:

slick.dbs.default.db.username = "envisia_finder" it will happen, but only on windows, not on mac/linux
if I change it to slick.dbs.default.db.user = "envisia_finder" it will work.

Just aweful stacktraces and if the user is not set it will use the default user. maybe thats why it worked on my mac/linux machine since I have a superuser like my user. Just an aweful stacktrace on PostgreSQL 9.4 (not on 9.3)

However I think it would be great if we somehow give a warning if the user/password is not set. especially since postgresql-9.4 jdbc driver somehow has a different stacktrace than postgresql-9.3 jdbc driver

@dotta
Copy link
Contributor

dotta commented Nov 11, 2015

Nice finding! I think it may make sense to have a warning if the user/password is not set, though the right place for doing it is in Slick itself. Before opening a ticket you may want to check on the slick mailing list what they think about it.

@schmitch
Copy link
Contributor

@dotta okai I will raise a thread tomorrow on the slick mailing list.

@dotta
Copy link
Contributor

dotta commented Nov 11, 2015

Thanks!

@jacobenget
Copy link

Just wanted to chime in that I had the same issue due to setting the configuration property slick.dbs.default.db.username instead of slick.dbs.default.db.user and then seeing a similar stack trace to the one above.

I was thinking that username was correct because the documentation on connecting to a database without Slick uses db.default.username and I assumed that changing over to using slick instead of jdbc just meant replacing db.default with slick.dbs.default.db in the relevant settings, which seems to be illustrated here. But I was wrong, and the error/stack trace didn't provide any help.

The way I came across the solution was by seeing this SO post and spotting the difference between the 'correct' settings mentioned there to the settings I was trying to use (I only mention this to point out that the solution frustratingly took me a while to find).

I see that the use of the user setting is mentioned offhand in the migration guide, but only because the documentation incorrectly mentions that the relevant jdbc setting is db.default.user.

I'm guessing that jbdc changed from using the property user to username recently (just a total guess on how this difference has come up), and play-slick's settings and documentation haven't been updated to reflect this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants