Dear Heroku/Play experts,
I'm new to Heroku and Play 2.0 (with Java) and am trying to get my first db-backed Heroku app up and running (I'm using the zentask app for learning purposes). I've been reading the related documents on stackoverflow and @James Ward's Play2torial very thoroughly but can't seem to find a solution to a problem I'm having:
When pushing my files to Heroku I always get a "Driver not found" error for the postgres driver - just as if it weren't installed on Heroku. I've pretty much tried everything that you, the experts, have proposed as solutions but nothing has worked. I even tried copying a jdbc driver jar into the lib
folder to compensate for the missing jdbc jar
but then I get some error concerning missing validation - this might be because I couldn't find the jar for 9.1-901-1.jdbc4
on the postgres website. In any case, your solutions suggest that this postgres driver should be there out of the box as the standard setup of Heroku so I'm getting a bit frustrated...
Hence, please find below the "driver not found error" with the files involved and the resulting error message.
I would be very, very grateful for your advice. Thanks a lot in advance! Best,
Horacio
Here are my files:
Procfile
:
web: target/start -Dhttp.port=${PORT} ${JAVA_OPTS} -Dconfig.resource=application.conf
Build.scala
:
import sbt._
import Keys._
import PlayProject._
object ApplicationBuild extends Build {
val appName = "Myapp"
val appVersion = "1.0"
val main = PlayProject(appName, appVersion, mainLang = JAVA)
val appDependencies = Seq(
"postgresql" % "postgresql" % "9.1-901-1.jdbc4"
)
}
application.conf
:
application.name=myapp
application.secret="some secret"
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://some URL"
ebean.default="models.*"
logger=ERROR
logger.play=INFO
logger.application=DEBUG
error message:
2012-11-23T17:39:35+00:00 heroku[web.1]: State changed from crashed to starting
2012-11-23T17:39:41+00:00 heroku[web.1]: Starting process with command `target/start -Dhttp.port=${PORT} ${JAVA_OPTS} -Dconfig.resource=application.conf`
2012-11-23T17:39:42+00:00 app[web.1]: Play server process ID is 2
2012-11-23T17:39:43+00:00 app[web.1]: Oops, cannot start the server.
2012-11-23T17:39:43+00:00 app[web.1]: Configuration error: Configuration error [Driver not found: [org.postgresql.Driver]]
2012-11-23T17:39:43+00:00 app[web.1]: at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:71)
2012-11-23T17:39:43+00:00 app[web.1]: at play.api.Configuration.reportError(Configuration.scala:258)
2012-11-23T17:39:43+00:00 app[web.1]: at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
2012-11-23T17:39:43+00:00 app[web.1]: at play.api.db.BoneCPApi.play$api$db$BoneCPApi$$register(DB.scala:283)
2012-11-23T17:39:43+00:00 app[web.1]: at play.api.db.BoneCPApi$$anonfun$4.apply(DB.scala:386)
2012-11-23T17:39:43+00:00 app[web.1]: at play.api.db.BoneCPApi$$anonfun$4.apply(DB.scala:390)
2012-11-23T17:39:43+00:00 app[web.1]: at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
2012-11-23T17:39:43+00:00 app[web.1]: at scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
2012-11-23T17:39:43+00:00 app[web.1]: at scala.collection.immutable.Set$Set1.foreach(Set.scala:86)
2012-11-23T17:39:43+00:00 app[web.1]: at play.api.db.BoneCPPlugin.play$api$db$BoneCPPlugin$$dbApi(DB.scala:211)
2012-11-23T17:39:43+00:00 app[web.1]: at play.api.db.BoneCPPlugin.onStart(DB.scala:240)
2012-11-23T17:39:43+00:00 app[web.1]: at play.api.Play$$anonfun$start$1.apply(Play.scala:60)
2012-11-23T17:39:43+00:00 app[web.1]: at scala.collection.immutable.Set$Set1.map(Set.scala:73)
2012-11-23T17:39:43+00:00 app[web.1]: at scala.collection.immutable.Set$Set1.scala$collection$SetLike$$super$map(Set.scala:73)
2012-11-23T17:39:43+00:00 app[web.1]: at scala.collection.SetLike$class.map(SetLike.scala:93)
2012-11-23T17:39:43+00:00 app[web.1]: at play.api.db.BoneCPApi.<init>(DB.scala:386)
2012-11-23T17:39:43+00:00 app[web.1]: at play.api.Play$$anonfun$start$1.apply(Play.scala:60)
2012-11-23T17:39:43+00:00 app[web.1]: at play.api.Play$.start(Play.scala:60)
2012-11-23T17:39:43+00:00 app[web.1]: at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
2012-11-23T17:39:43+00:00 app[web.1]: at play.core.StaticApplication.<init>(ApplicationProvider.scala:51)
2012-11-23T17:39:43+00:00 app[web.1]: at play.core.server.NettyServer$$anonfun$main$5.apply(NettyServer.scala:153)
2012-11-23T17:39:43+00:00 app[web.1]: at play.core.server.NettyServer$.main(NettyServer.scala:152)
2012-11-23T17:39:43+00:00 app[web.1]: at scala.collection.immutable.List.foreach(List.scala:45)
2012-11-23T17:39:43+00:00 app[web.1]: at play.core.server.NettyServer$.createServer(NettyServer.scala:132)
2012-11-23T17:39:43+00:00 app[web.1]: at play.core.server.NettyServer$$anonfun$main$5.apply(NettyServer.scala:152)
2012-11-23T17:39:43+00:00 app[web.1]: at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
2012-11-23T17:39:43+00:00 app[web.1]: at scala.Option.map(Option.scala:133)
2012-11-23T17:39:43+00:00 app[web.1]: at play.core.server.NettyServer.main(NettyServer.scala)
2012-11-23T17:39:43+00:00 app[web.1]: Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver
2012-11-23T17:39:43+00:00 app[web.1]: at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
2012-11-23T17:39:43+00:00 app[web.1]: at java.security.AccessController.doPrivileged(Native Method)
2012-11-23T17:39:43+00:00 app[web.1]: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
2012-11-23T17:39:43+00:00 app[web.1]: ... 24 more
2012-11-23T17:39:43+00:00 app[web.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
2012-11-23T17:39:43+00:00 app[web.1]: at java.lang.Class.forName(Class.java:264)
2012-11-23T17:39:43+00:00 app[web.1]: at play.api.db.BoneCPApi.play$api$db$BoneCPApi$$register(DB.scala:281)
2012-11-23T17:39:43+00:00 app[web.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
2012-11-23T17:39:43+00:00 app[web.1]: at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
2012-11-23T17:39:43+00:00 app[web.1]: at java.lang.Class.forName0(Native Method)
2012-11-23T17:39:44+00:00 heroku[web.1]: Process exited with status 255
2012-11-23T17:39:44+00:00 heroku[web.1]: State changed from starting to crashed
2012-11-23T17:40:19+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=SOME_URL.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=