PlayFramework – Java

So far I have really liked this concept. The only con is that some times is difficult to find full examples that use the latest version.

Installing sbt

We need sbt for compiling and running Play applications.

brew install sbt@1

Executing a first application

Check the tutorials page to see how to create a first project.

Pretty much:

sbt new playframework/play-java-seed.g8
sbt run

And then visit localhost:9000

Play 2.6 throws the following exception unless an additional dependency is added:

[error] a.a.ActorSystemImpl - Uncaught error from thread []: javax/xml/bind/DatatypeConverter, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[application]

Add the following dependency to build.sbt to avoid the previous exception:

libraryDependencies += "javax.xml.bind" % "jaxb-api" % "2.1"


This is a good REST tutorial using the play framework.

In order to accept post requests without CSRF, you can disable the automatic checkup by adding the following line to application.conf

play.filters.disabled += play.filters.csrf.CSRFFilter

At some point I will come back to add security.


Accessing a SQL Database

Notes for implementing a DatabaseExecutionContext.
The previous notes may have need to get complemented with this project and this answer.

Main page for Evolutions.