I’m switching to Heroku and trying to commit a Play 2.0 Project using ClearDB. All seems to compile fine, except I get an error when Heroku tries to start the application:
2012-08-02T18:10:45+00:00 heroku[web.1]: State changed from up to starting 2012-08-02T18:10:45+00:00 heroku[slugc]: Slug compilation finished 2012-08-02T18:10:48+00:00 heroku[web.1]: Stopping all processes with SIGTERM 2012-08-02T18:10:48+00:00 heroku[web.1]: Starting process with command `target/start -Dhttp.port=47334 -Ddb.default.url=mysql://bf64fa6afab971:4b5fe3e5@us-cdbr-east.cleardb.com/heroku_32ef64c5764c759?reconnect=true -DapplyEvolutions.default=true -Xmx384m -Xss512k -XX:+UseCompressedOops` 2012-08-02T18:10:51+00:00 app[web.1]: Play server process ID is 2 2012-08-02T18:10:51+00:00 heroku[web.1]: Process exited with status 143 2012-08-02T18:10:52+00:00 app[web.1]: [error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 10. Exception: null
I’ve done all the Googling and research but have no idea what’s causing the error:
Procfile
web: target/start -Dhttp.port=$PORT -Ddb.default.url=$CLEARDB_DATABASE_URL -DapplyEvolutions.default=true $JAVA_OPTS
application.conf
db.default.driver=com.mysql.jdbc.Driver
heroku conf
CLEARDB_DATABASE_URL: mysql://myusername:mypassword@us-cdbr-east.cleardb.com/heroku_32ef64c5764c759?reconnect=true DATABASE_URL: postgres://myusername:mypassword@ec2-107-20-235-95.compute-1.amazonaws.com/sbzwmvjnqs ENVIRONMENT_MODE: stage JAVA_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops PATH: .sbt_home/bin:/usr/local/bin:/usr/bin:/bin REPO: /app/.sbt_home/.ivy2/cache SBT_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops SHARED_DATABASE_URL: postgres://myusername:mypassword@ec2-107-20-235-95.compute-1.amazonaws.com/sbzwmvjnqs
This was the last configuration issue before I got Play Framework 2.0.2 to work with MySQL (through ClearDB) on Heroku.
Although it wasn’t giving an actual error, it was just saying:
The actual problem turned out to be that Heroku on “standard free” mode, with ClearDB just gives you 10 simultaneous connections. I’ve seen it mentioned before that by default, play will use 60 connections.
Solution:
In application.conf, add: