Quick rant (downgrade) of the Play! Framework, just wasted another hour trying to find out why my configuration is not applied. This is the second time this month so I need to let out some steam.
Generally I’m a big fan of Play! It is easy to use, easy to setup and fast to develop with. Its like Struts with JRebel but feels more fresh. Okay, back to the rant.
Lets say you want to make sure that each time you run your application, the HSQLDB is initialized into the same location.
Well, you go to application.conf. Find the db.url field, comment it in, change it to
db.url=jdbc:hsqldb:file:my/fav/static/location
Done! 10 minutes you notice that
/private/var/folders/Em/EmtX3-Q+EgOCv9GUy0k8dU+++TI/-Tmp-/Jetty_0_0_0_0_8080_webapp____.7fbo9s/webapp/WEB-INF/application/db/db
is used as the DB location. After grepping, doublechecking, debugging and swearing you find in the internals of play that db.url, db.pass, db.user, db.driver are ignored if db=fs is set. WTF? No warning, no nothing that your configuration gets overwritten, aaargh!
Lets say your deployment is not Play! (they advise you to use play run to run apps written using Play! instead of a classic servlet container). Lets say you target Jetty instead.
Well, you deploy your WAR archive to Jetty and develop as you would before but then you discover that your files are no longer reloaded. You also discover that you get tons of database exceptions. After grepping, doublechecking, debuggin and swearing you find in the internals of play that once you ditch the play run and move to a classic container Play! will presume that you must have been smoking crack when you wrote application.mode=dev in your configuration file. It will just override it and make sure that you run in production mode this time. WTF? No warning, no nothing that your configuration gets overwritten, aaargh.
So next time you’re having problems with Play!, do some grepping, doublechecking, debuggin and swearing and find the location where your configuration options are overwritten by some Java code inside play.jar.