Play Framework PostgreSQL db.default.username defaulting to linux username - postgresql

I keep getting errors like this...
app[web.1]: Configuration error: Configuration error[Cannot connect to database [default]]
app[web.1]: at scala.collection.immutable.List.foreach(List.scala:381)
app[web.1]: Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "lcnjgrwbmbffwv"
app[web.1]: at play.core.StaticApplication.<init>(ApplicationProvider.scala:55)
app[web.1]: at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:408)
app[web.1]: at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)
app[web.1]: at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31)
app[web.1]: at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21)
app[web.1]: at org.postgresql.Driver.makeConnection(Driver.java:410)
app[web.1]: at java.sql.DriverManager.getConnection(DriverManager.java:664)
app[web.1]: at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:363)
app[web.1]: at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:240)
app[web.1]: at java.sql.DriverManager.getConnection(DriverManager.java:247)
app[web.1]: at org.postgresql.Driver.connect(Driver.java:280)
app[web.1]: at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:416)
app[web.1]: at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:120)
app[web.1]: at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
app[web.1]: ... 18 more
heroku[web.1]: Process exited with status 255
Not just in Heroku, but when I run my Play app with a user whose name is different than the default user name in the database.
My Play Framework "application.conf" is like this...
db.default.username="nameOfDatabaseUser"
db.default.password="passOfDatabaseUser"
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://urlofdatabase:5432/name_of_database"
Here's the thing. When my terminal user is named "nameOfDatabaseUser", it works. But when my terminal user has a different name, it connects to the database as the name of the current Linux terminal user.
In the above case it appears that Heroku tried to connect as a user lcnjgrwbmbffwv and there was no user lcnjgrwbmbffwv in the database.
How do I specify the default database username so that it doesn't use my terminal username?

The correct key to specify the user is db.default.user, not db.default.username.

Related

Metabase on Heroku - Postgres need to add a role to run migrations

I’m upgrading to latest version with heroku deployed app using the binary from https://github.com/metabase/metabase-deploy per the instructions, but am receiving ERROR: permission denied for relation databasechangelog. Tailed logs are below
2018-04-13T19:34:59.959056+00:00 heroku[web.1]: Starting process with command `HEROKU=true ./bin/start`
2018-04-13T19:35:01.482994+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2018-04-13T19:35:01.486299+00:00 app[web.1]: Using these JAVA_OPTS: -Xmx300m -Xss512k -Dfile.encoding=UTF-8 -Xmx248m -XX:-UseGCOverheadLimit -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:+IgnoreUnrecognizedVMOptions -Djava.awt.headless=true -Dfile.encoding=UTF-8 --add-opens=java.base/java.net=ALL-UNNAMED --add-modules=java.xml.bind
2018-04-13T19:35:01.539500+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -Dfile.encoding=UTF-8
2018-04-13T19:35:07.709376+00:00 app[web.1]: 04-13 19:35:07 INFO metabase.util :: Loading Metabase...
2018-04-13T19:35:15.571783+00:00 app[web.1]: 04-13 19:35:15 INFO util.encryption :: DB details encryption is DISABLED for this Metabase instance. 🔓
2018-04-13T19:35:15.571795+00:00 app[web.1]: See http://www.metabase.com/docs/latest/operations-guide/start.html#encrypting-your-database-connection-details-at-rest for more information.
2018-04-13T19:35:23.403505+00:00 app[web.1]: 04-13 19:35:23 INFO metabase.core :: Starting Metabase in STANDALONE mode
2018-04-13T19:35:23.479490+00:00 app[web.1]: 04-13 19:35:23 INFO metabase.core :: Launching Embedded Jetty Webserver with config:
2018-04-13T19:35:23.479494+00:00 app[web.1]: {:port 22224}
2018-04-13T19:35:23.479496+00:00 app[web.1]:
2018-04-13T19:35:23.547747+00:00 app[web.1]: 04-13 19:35:23 INFO metabase.core :: Starting Metabase version v0.28.6 (83e3c0d release-0.28.6) ...
2018-04-13T19:35:23.548089+00:00 app[web.1]: 04-13 19:35:23 INFO metabase.core :: System timezone is 'Etc/UTC' ...
2018-04-13T19:35:24.159004+00:00 heroku[web.1]: State changed from starting to up
2018-04-13T19:35:27.859258+00:00 app[web.1]: 04-13 19:35:27 INFO metabase.core :: Setting up and migrating Metabase DB. Please sit tight, this may take a minute...
2018-04-13T19:35:27.861664+00:00 app[web.1]: 04-13 19:35:27 INFO metabase.db :: Verifying postgres Database Connection ...
2018-04-13T19:35:28.044132+00:00 app[web.1]: 04-13 19:35:28 INFO metabase.db :: Verify Database Connection ... ✅
2018-04-13T19:35:28.044416+00:00 app[web.1]: 04-13 19:35:28 INFO metabase.db :: Running Database Migrations...
2018-04-13T19:35:28.079543+00:00 app[web.1]: 04-13 19:35:28 INFO metabase.db :: Setting up Liquibase...
2018-04-13T19:35:28.201705+00:00 app[web.1]: 04-13 19:35:28 INFO metabase.db :: Liquibase is ready.
2018-04-13T19:35:28.201963+00:00 app[web.1]: 04-13 19:35:28 INFO metabase.db :: Checking if Database has unrun migrations...
2018-04-13T19:35:44.048862+00:00 app[web.1]: 04-13 19:35:44 INFO metabase.db :: Database has unrun migrations. Waiting for migration lock to be cleared...
2018-04-13T19:35:44.052917+00:00 app[web.1]: 04-13 19:35:44 INFO metabase.db :: Migration lock is cleared. Running migrations...
2018-04-13T19:35:57.677299+00:00 app[web.1]: org.postgresql.util.PSQLException: ERROR: permission denied for relation databasechangelog
2018-04-13T19:35:57.677543+00:00 app[web.1]: at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2477)
2018-04-13T19:35:57.677591+00:00 app[web.1]: at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2190)
2018-04-13T19:35:57.677695+00:00 app[web.1]: at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:300)
2018-04-13T19:35:57.677725+00:00 app[web.1]: at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428)
2018-04-13T19:35:57.677754+00:00 app[web.1]: at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354)
2018-04-13T19:35:57.677790+00:00 app[web.1]: at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:169)
2018-04-13T19:35:57.677822+00:00 app[web.1]: at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:136)
2018-04-13T19:35:57.677852+00:00 app[web.1]: at clojure.java.jdbc$db_do_execute_prepared_statement$fn__1839.invoke(jdbc.clj:952)
2018-04-13T19:35:57.677883+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:784)
2018-04-13T19:35:57.678002+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:711)
2018-04-13T19:35:57.678030+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:724)
2018-04-13T19:35:57.678069+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:711)
2018-04-13T19:35:57.678097+00:00 app[web.1]: at clojure.java.jdbc$db_do_execute_prepared_statement.invokeStatic(jdbc.clj:951)
2018-04-13T19:35:57.678134+00:00 app[web.1]: at clojure.java.jdbc$db_do_execute_prepared_statement.invoke(jdbc.clj:945)
2018-04-13T19:35:57.678163+00:00 app[web.1]: at clojure.java.jdbc$db_do_prepared.invokeStatic(jdbc.clj:983)
2018-04-13T19:35:57.678192+00:00 app[web.1]: at clojure.java.jdbc$db_do_prepared.invoke(jdbc.clj:963)
2018-04-13T19:35:57.678223+00:00 app[web.1]: at clojure.java.jdbc$execute_BANG_$execute_helper__1910.invoke(jdbc.clj:1364)
2018-04-13T19:35:57.678253+00:00 app[web.1]: at clojure.java.jdbc$execute_BANG_.invokeStatic(jdbc.clj:1366)
2018-04-13T19:35:57.678331+00:00 app[web.1]: at clojure.java.jdbc$execute_BANG_.invoke(jdbc.clj:1337)
2018-04-13T19:35:57.678368+00:00 app[web.1]: at clojure.java.jdbc$execute_BANG_.invokeStatic(jdbc.clj:1356)
2018-04-13T19:35:57.678402+00:00 app[web.1]: at clojure.java.jdbc$execute_BANG_.invoke(jdbc.clj:1337)
2018-04-13T19:35:57.678443+00:00 app[web.1]: at metabase.db$migrate_up_if_needed_BANG_.invokeStatic(db.clj:169)
2018-04-13T19:35:57.678473+00:00 app[web.1]: at metabase.db$migrate_up_if_needed_BANG_.invoke(db.clj:155)
2018-04-13T19:35:57.678506+00:00 app[web.1]: at metabase.db$migrate_BANG_$fn__4414.invoke(db.clj:258)
2018-04-13T19:35:57.678537+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:741)
2018-04-13T19:35:57.678576+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:711)
2018-04-13T19:35:57.678604+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:776)
2018-04-13T19:35:57.678628+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:711)
2018-04-13T19:35:57.678662+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:724)
2018-04-13T19:35:57.678692+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:711)
2018-04-13T19:35:57.678734+00:00 app[web.1]: at metabase.db$migrate_BANG_.invokeStatic(db.clj:246)
2018-04-13T19:35:57.678763+00:00 app[web.1]: at metabase.db$migrate_BANG_.invoke(db.clj:227)
2018-04-13T19:35:57.678794+00:00 app[web.1]: at metabase.db$run_schema_migrations_BANG_.invokeStatic(db.clj:381)
2018-04-13T19:35:57.678826+00:00 app[web.1]: at metabase.db$run_schema_migrations_BANG_.invoke(db.clj:376)
2018-04-13T19:35:57.678859+00:00 app[web.1]: at metabase.db$setup_db_BANG_.invokeStatic(db.clj:399)
2018-04-13T19:35:57.678889+00:00 app[web.1]: at metabase.db$setup_db_BANG_.doInvoke(db.clj:392)
2018-04-13T19:35:57.678924+00:00 app[web.1]: at clojure.lang.RestFn.invoke(RestFn.java:421)
2018-04-13T19:35:57.679001+00:00 app[web.1]: at metabase.core$init_BANG_.invokeStatic(core.clj:154)
2018-04-13T19:35:57.679031+00:00 app[web.1]: at metabase.core$init_BANG_.invoke(core.clj:133)
2018-04-13T19:35:57.679059+00:00 app[web.1]: at metabase.core$start_normally.invokeStatic(core.clj:258)
2018-04-13T19:35:57.679088+00:00 app[web.1]: at metabase.core$start_normally.invoke(core.clj:251)
2018-04-13T19:35:57.679118+00:00 app[web.1]: at metabase.core$_main.invokeStatic(core.clj:279)
2018-04-13T19:35:57.679293+00:00 app[web.1]: at metabase.core$_main.doInvoke(core.clj:274)
2018-04-13T19:35:57.679314+00:00 app[web.1]: at clojure.lang.RestFn.invoke(RestFn.java:397)
2018-04-13T19:35:57.679349+00:00 app[web.1]: at clojure.lang.AFn.applyToHelper(AFn.java:152)
2018-04-13T19:35:57.679378+00:00 app[web.1]: at clojure.lang.RestFn.applyTo(RestFn.java:132)
2018-04-13T19:35:57.679413+00:00 app[web.1]: at metabase.core.main(Unknown Source)
2018-04-13T19:35:57.679817+00:00 app[web.1]: 04-13 19:35:57 ERROR metabase.core :: Metabase Initialization FAILED: ERROR: permission denied for relation databasechangelog
2018-04-13T19:35:57.683116+00:00 app[web.1]: 04-13 19:35:57 INFO metabase.core :: Metabase Shutting Down ...
2018-04-13T19:35:57.683752+00:00 app[web.1]: 04-13 19:35:57 INFO metabase.core :: Metabase Shutdown COMPLETE
2018-04-13T19:35:58.184227+00:00 heroku[web.1]: State changed from up to crashed
2018-04-13T19:35:58.075189+00:00 heroku[web.1]: Process exited with status 1
It’s the same issue as http://discourse.metabase.com/t/migration-to-new-server-and-docker-instance/3139 but it’s deployed using Heroku, so I can’t add databasechangelog as a role. Migrating questions and dashboards manually isn’t really an option. Thoughts?
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO databasechangelog;
> ERROR: role "databasechangelog" does not exist.
CREATE ROLE databasechangelog;
> ERROR: permission denied to create role
The error is
ERROR: permission denied for relation databasechangelog
So I think you want to do:
grant all privileges on databasechangelog to <username-metabase-is-using-to-connect>

heroku permission denied on netty start

I have deployed a play scala/java web app on heroku that uses an embeded netty server. The Procfile command is web: target/universal/stage/bin/mmbu-timesheets -Dhttp.port=80
Taken from heroku logs:
2015-04-27T13:49:27.160198+00:00 heroku[web.1]: Starting process with command `target/universal/stage/bin/mmbu-timesheets -Dhttp.port=80`
2015-04-27T13:49:29.321552+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx384m -Xss512k -Dfile.encoding=UTF-8 -Djava.rmi.server.useCodebaseOnly=true
2015-04-27T13:49:29.898379+00:00 app[web.1]: Play server process ID is 3
2015-04-27T13:49:32.549840+00:00 app[web.1]: [[37minfo[0m] application - mongodb connection ds031701.mongolab.com:31701 db->heroku_app36286493
2015-04-27T13:49:33.374954+00:00 app[web.1]: [[37minfo[0m] play - Application started (Prod)
2015-04-27T13:49:33.628067+00:00 app[web.1]: Oops, cannot start the server.
2015-04-27T13:49:33.630568+00:00 app[web.1]: at play.core.server.NettyServer$$anonfun$8.apply(NettyServer.scala:89)
2015-04-27T13:49:33.630523+00:00 app[web.1]: at play.core.server.NettyServer$$anonfun$8.apply(NettyServer.scala:92)
2015-04-27T13:49:33.630859+00:00 app[web.1]: at play.core.server.NettyServer$.createServer(NettyServer.scala:206)
2015-04-27T13:49:33.630358+00:00 app[web.1]: org.jboss.netty.channel.ChannelException: Failed to bind to: /0.0.0.0:80
2015-04-27T13:49:33.630483+00:00 app[web.1]: at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:272)
2015-04-27T13:49:33.630606+00:00 app[web.1]: at scala.Option.map(Option.scala:146)
2015-04-27T13:49:33.630802+00:00 app[web.1]: at play.core.server.NettyServer.<init>(NettyServer.scala:89)
2015-04-27T13:49:33.630898+00:00 app[web.1]: at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:243)
2015-04-27T13:49:33.630941+00:00 app[web.1]: at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:238)
2015-04-27T13:49:33.631096+00:00 app[web.1]: at play.core.server.NettyServer$.main(NettyServer.scala:238)
2015-04-27T13:49:33.630975+00:00 app[web.1]: at scala.Option.map(Option.scala:146)
2015-04-27T13:49:33.631150+00:00 app[web.1]: at play.core.server.NettyServer.main(NettyServer.scala)
2015-04-27T13:49:33.633017+00:00 app[web.1]: Caused by: java.net.SocketException: Permission denied
2015-04-27T13:49:33.633065+00:00 app[web.1]: at sun.nio.ch.Net.bind0(Native Method)
2015-04-27T13:49:33.633136+00:00 app[web.1]: at sun.nio.ch.Net.bind(Net.java:437)
2015-04-27T13:49:33.633179+00:00 app[web.1]: at sun.nio.ch.Net.bind(Net.java:429)
2015-04-27T13:49:33.633235+00:00 app[web.1]: at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
2015-04-27T13:49:33.633396+00:00 app[web.1]: at org.jboss.netty.channel.socket.nio.NioServerBoss$RegisterTask.run(NioServerBoss.java:193)
2015-04-27T13:49:33.633444+00:00 app[web.1]: at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:372)
2015-04-27T13:49:33.633550+00:00 app[web.1]: at org.jboss.netty.channel.socket.nio.NioServerBoss.run(NioServerBoss.java:42)
2015-04-27T13:49:33.633600+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2015-04-27T13:49:33.633643+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2015-04-27T13:49:33.633305+00:00 app[web.1]: at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
2015-04-27T13:49:33.633525+00:00 app[web.1]: at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:296)
2015-04-27T13:49:33.633703+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:745)
2015-04-27T13:49:34.926567+00:00 heroku[web.1]: Process exited with status 255
2015-04-27T13:49:34.945535+00:00 heroku[web.1]: State changed from starting to crashed
I get "Permission denied" exception. Is there a way to start the netty server in heroku?
I had to let heroky specify the port with
web: target/universal/stage/bin/mmbu-timesheets -Dhttp.port=$PORT
in Procfile

Play Framework and Ebean: Error in trying to obtain a connection

I have an Akka thread in my Play Framework application (hosted on Heroku) that gets called every 10 minutes. In this thread I access many models in my database in quick succession. After compiling and starting the application this thread runs fine for a few hours. Eventually (and for reasons unknown) the logger returns this:
c.j.b.PoolWatchThread - Error in trying to obtain a connection
My DB configuration (Heroku's PostgreSQL Basic plan) looks like this:
db.default.user=USER
db.default.password=PASS
db.default.jndiName=DefaultDS
db.default.driver=org.postgresql.Driver
db.default.url=URL
db.default.partitionCount=2
db.default.maxConnectionsPerPartition=5
db.default.minConnectionsPerPartition=5
db.default.acquireIncrement=1
db.default.acquireRetryAttempts=1
db.default.acquireRetryDelay=5 seconds
db.default.maxConnectionAge=1 hour
db.default.idleMaxAge=10 minute
I have adjusted these variables without solving the problem.
Here is the stack trace
2013-08-11T21:53:29.304108+00:00 app[web.2]: [error] c.j.b.PoolWatchThread - Error in trying to obtain a connection. Retrying in 5000ms
2013-08-11T21:53:29.304108+00:00 app[web.2]: org.postgresql.util.PSQLException: FATAL: too many connections for role "[DB USER NAME]"
2013-08-11T21:53:29.304108+00:00 app[web.2]: at org.postgresql.core.v3.ConnectionFactoryImpl.readStartupMessages(ConnectionFactoryImpl.java:469) ~[postgresql-9.1-901.jdbc4.jar:na]
2013-08-11T21:53:29.304108+00:00 app[web.2]: at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:112) ~[postgresql-9.1-901.jdbc4.jar:na]
2013-08-11T21:53:29.304108+00:00 app[web.2]: at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66) ~[postgresql-9.1-901.jdbc4.jar:na]
2013-08-11T21:53:29.304108+00:00 app[web.2]: at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125) ~[postgresql-9.1-901.jdbc4.jar:na]
2013-08-11T21:53:29.304108+00:00 app[web.2]: at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30) ~[postgresql-9.1-901.jdbc4.jar:na]
2013-08-11T21:53:29.304108+00:00 app[web.2]: at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22) ~[postgresql-9.1-901.jdbc4.jar:na]
I have a hunch it could be something to do with how and when I query the DB for the models. Like, maybe the connections are not released? Help is appreciated.
Edit:
More from the logger
2013-08-13T14:43:49.257852+00:00 app[web.1]: javax.persistence.PersistenceException: java.sql.SQLException: Timed out waiting for a free available connection.
2013-08-13T14:43:49.257852+00:00 app[web.1]: at com.avaje.ebeaninternal.server.transaction.TransactionManager.createQueryTransaction(TransactionManager.java:368)
2013-08-13T14:43:49.257852+00:00 app[web.1]: at com.avaje.ebeaninternal.server.core.DefaultServer.createQueryTransaction(DefaultServer.java:2060)
2013-08-13T14:43:49.257852+00:00 app[web.1]: at com.avaje.ebeaninternal.server.core.OrmQueryRequest.initTransIfRequired(OrmQueryRequest.java:181)
2013-08-13T14:43:49.257852+00:00 app[web.1]: at com.avaje.ebeaninternal.server.core.DefaultServer.findList(DefaultServer.java:1501)
2013-08-13T14:43:49.257852+00:00 app[web.1]: at com.avaje.ebeaninternal.server.querydefn.DefaultOrmQuery.findList(DefaultOrmQuery.java:904)
2013-08-13T14:43:49.257852+00:00 app[web.1]: at com.avaje.ebeaninternal.util.DefaultExpressionList.findList(DefaultExpressionList.java:177)
2013-08-13T14:43:49.257852+00:00 app[web.1]: at models.Person.findByHandle(Person.java:85)
2013-08-13T14:43:49.257852+00:00 app[web.1]: at models.NapalmJob.run(NapalmJob.java:41)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at models.NapalmActor.onReceive(NapalmActor.java:9)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:159)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at akka.actor.ActorCell.invoke(ActorCell.scala:386)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at akka.dispatch.Mailbox.run(Mailbox.scala:212)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:502)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:262)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1478)
2013-08-13T14:43:49.258200+00:00 app[web.1]: at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)
2013-08-13T14:43:49.258200+00:00 app[web.1]: Caused by: java.sql.SQLException: Timed out waiting for a free available connection.
2013-08-13T14:43:49.258200+00:00 app[web.1]: at com.jolbox.bonecp.BoneCP.getConnection(BoneCP.java:503)
2013-08-13T14:43:49.258200+00:00 app[web.1]: at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:114)
2013-08-13T14:43:49.258200+00:00 app[web.1]: at play.db.ebean.EbeanPlugin$WrappingDatasource.getConnection(EbeanPlugin.java:146)
2013-08-13T14:43:49.258200+00:00 app[web.1]: at com.avaje.ebeaninternal.server.transaction.TransactionManager.createQueryTransaction(TransactionManager.java:338)
2013-08-13T14:43:49.258200+00:00 app[web.1]: ... 18 more
Queries are being formed but are not executed... Could some queries be taking longer to finish then others and thus not releasing the resources?
This answer may help:
Heroku POSTGRESQL - "Too many connections for role" error
Also, are you overriding Play's default settings?

Errors in evolutions on Heroku

I tried pushing some evolutions to Heroku:
2012-08-30T10:58:00+00:00 heroku[slugc]: Slug compilation finished
2012-08-30T10:58:02+00:00 heroku[web.1]: Starting process with command `target/start -Dhttp.port=32436 -Xmx384m -Xss512k
-XX:+UseCompressedOops`
2012-08-30T10:58:03+00:00 app[web.1]: Play server process ID is 2
2012-08-30T10:58:05+00:00 app[web.1]: [←[37minfo←[0m] play - database [default] connected at [Database-address]
2012-08-30T10:58:05+00:00 app[web.1]: CREATE TABLE `unapprovedteaminfo` (
---
Copy of 1.sql
---
2012-08-30T10:58:05+00:00 app[web.1]: VALUES (1, 2, 2, '2012-01-01 00:00:00', 'k');
2012-08-30T10:58:05+00:00 app[web.1]: ERROR: syntax error at or near "`"
2012-08-30T10:58:05+00:00 app[web.1]: Position: 14 [ERROR:0, SQLSTATE:42601]
2012-08-30T10:58:05+00:00 app[web.1]: Oops, cannot start the server.
2012-08-30T10:58:05+00:00 app[web.1]: PlayException: Database 'default' is in inconsistent state! [An evolution has not
been applied properly. Please check the problem and resolve it manually before marking it as resolved.]
2012-08-30T10:58:05+00:00 app[web.1]: at play.api.db.evolutions.Evolutions$.checkEvolutionsState(Evolutions.scala:155)
2012-08-30T10:58:05+00:00 app[web.1]: at play.api.db.evolutions.Evolutions$.databaseEvolutions(Evolutions.scala:308)
2012-08-30T10:58:05+00:00 app[web.1]: at play.api.db.evolutions.Evolutions$.evolutionScript(Evolutions.scala:284)
2012-08-30T10:58:05+00:00 app[web.1]: at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.s
cala:412)
2012-08-30T10:58:05+00:00 app[web.1]: at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.s
cala:410)
2012-08-30T10:58:05+00:00 app[web.1]: at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59
)
2012-08-30T10:58:05+00:00 app[web.1]: at scala.collection.immutable.List.foreach(List.scala:45)
2012-08-30T10:58:05+00:00 app[web.1]: at play.api.db.evolutions.EvolutionsPlugin.onStart(Evolutions.scala:410)
2012-08-30T10:58:05+00:00 app[web.1]: at play.api.Play$$anonfun$start$1.apply(Play.scala:60)
2012-08-30T10:58:05+00:00 app[web.1]: at play.api.Play$$anonfun$start$1.apply(Play.scala:60)
2012-08-30T10:58:05+00:00 app[web.1]: at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59
)
2012-08-30T10:58:05+00:00 app[web.1]: at scala.collection.immutable.List.foreach(List.scala:45)
2012-08-30T10:58:05+00:00 app[web.1]: at play.api.Play$.start(Play.scala:60)
2012-08-30T10:58:05+00:00 app[web.1]: at play.core.StaticApplication.<init>(ApplicationProvider.scala:51)
2012-08-30T10:58:05+00:00 app[web.1]: at play.core.server.NettyServer$.createServer(NettyServer.scala:132)
2012-08-30T10:58:05+00:00 app[web.1]: at play.core.server.NettyServer$$anonfun$main$5.apply(NettyServer.scala:153)
2012-08-30T10:58:05+00:00 app[web.1]: at play.core.server.NettyServer$$anonfun$main$5.apply(NettyServer.scala:152)
2012-08-30T10:58:05+00:00 app[web.1]: at scala.Option.map(Option.scala:133)
2012-08-30T10:58:05+00:00 app[web.1]: at play.core.server.NettyServer$.main(NettyServer.scala:152)
2012-08-30T10:58:05+00:00 app[web.1]: at play.core.server.NettyServer.main(NettyServer.scala)
2012-08-30T10:58:06+00:00 heroku[web.1]: Process exited with status 255
2012-08-30T10:58:06+00:00 heroku[web.1]: State changed from starting to crashed
These evolutions would work just fine with H2, I guess there must be some issues with POSTGRESQL syntax. Anyway, the problem I am having now is that, even if I change 1.sql and push the new version on Heroku, the same error will show up in the logs - the copied 1.sql does not change according to the new pushed version.
If you're sending to Heroku 1.sql file generated for H2, there is big chance that they will conflict, instead, set the Heroku's url in application.conf as db.default.url and run it in dev mode on localhost first to generate valid Postres SQL. Also you will need to comment out the db.default.user and db.default.password settings, as Heroku's URL contains this information already.
If you don't know current connection's URL you will find it on:
https://postgres.heroku.com/ -> YourDBs -> db-name -> Connection settings -> JDBC URL
To connect from localhost (or other machine, not in the Heroku's space) you need to add this param to the URL:
&ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory
Thanks to this approach you can test your application locally with established connection to the remote Heroku's DB, (don't be surprised - that combination will be much slower than working with local app + local DB or Heroku app + Heroku DB) anyway for testing it's better than repeatedly pushing small fixes to the cloud.
Also you'll be able to perform evolutions from localhost - without pushing the code to Heroku, and it's really shorter approach if you have problems in your SQL.
Additionally it's good occasion to turn on SQL logging in local dev mode and hunt for redundant SQL queries, if you'll remove all not necessary queries and will be satisfied on localhost, after deploying to the Heroku, you will be just much more satisfied :)
Reset
If you'll create proper 1.sql file than most probably you'll need to reset your DB containing invalid structure (as I assume that's not a problem yet as you just moving from local to Heroku). First find a name of the DB for the current app (with bash, in app's folder):
heroku pg
And then reset it with (it will destroy all data so consider backup first if you don't want to loose your data!):
heroku pg:reset HEROKU_DATABASE_SOMEBASE
I think you have some problem with the definition in VALUES with the data time field. I posted my working evolutions config setup for play 2.4, Slick 3.0.3 & postgres. I got automatically generated the *.sql files placed in the evolution folder.
Regenerate evolution scripts in play 2
Cheers

Errors trying to bootstrap Play! app on Heroku

Cannot for the life of me get Heroku to build a skeleton database for my Play! app using a bootstrap. I've got a Bootstrap job and some YAML to load the object, but I get :-
2011-11-26T15:48:33+00:00 app[web.1]: 15:48:33,451 INFO ~ Starting /app
2011-11-26T15:48:33+00:00 app[web.1]: 15:48:33,454 INFO ~ Module crud is available (/app/modules/crud)
2011-11-26T15:48:33+00:00 app[web.1]: 15:48:33,454 INFO ~ Module secure is available (/app/modules/secure)
2011-11-26T15:48:35+00:00 app[web.1]: 15:48:35,179 INFO ~ Connected to jdbc:postgresql://ec2-107-20-239-110.compute-1.amazonaws.com/qsaljordae
2011-11-26T15:48:35+00:00 app[web.1]: 15:48:35,789 WARN ~ Defaults messsages file missing
2011-11-26T15:48:35+00:00 app[web.1]: 15:48:35,804 INFO ~ Application 'Humbug' is now started !
2011-11-26T15:48:35+00:00 app[web.1]: 15:48:35,860 WARN ~ Precompiled template /conf/initial-data.yml not found, trying to load it dynamically...
2011-11-26T15:48:35+00:00 app[web.1]: 15:48:35,989 DEBUG ~ select nextval ('hibernate_sequence')
2011-11-26T15:48:36+00:00 app[web.1]: 15:48:36,019 WARN ~ SQL Error: 0, SQLState: 42P01
2011-11-26T15:48:36+00:00 app[web.1]: 15:48:36,019 ERROR ~ ERROR: relation "hibernate_sequence" does not exist
2011-11-26T15:48:36+00:00 app[web.1]: 15:48:36,036 ERROR ~
2011-11-26T15:48:36+00:00 app[web.1]:
2011-11-26T15:48:36+00:00 app[web.1]: #68gdihi6a
2011-11-26T15:48:36+00:00 app[web.1]: Error during job execution (Bootstrap)
2011-11-26T15:48:36+00:00 app[web.1]:
2011-11-26T15:48:36+00:00 app[web.1]: Execution exception (In /app/Bootstrap.java around line 12)
2011-11-26T15:48:36+00:00 app[web.1]: RuntimeException occured : Cannot load fixture initial-data.yml: org.hibernate.exception.SQLGrammarException: could not get next sequence value
What is the problem with the hibernate_sequence table? That's not a table/object I created.
This bootstrap process worked fine in Dev on my local machine.
And the answer was to set jpa=ddl in the config, despite the warning not to do so in production....
# Specify the ddl generation pattern to use. Set to none to disable it
# (default to update in DEV mode, and none in PROD mode):
jpa.ddl=update