title: Play throws RuntimeException: java.lang.ExceptionInInitializerError
body: <p>I have the following Play controller:</p>
  
  <pre><code>package controllers
  
  import models.{Page, DB}
  import play.api._
  import play.api.data.Form
  import play.api.data.Forms._
  import play.api.libs.json.Json
  import play.api.mvc._
  
  class Application extends Controller {
  
    def index = Action {
      Ok(views.html.index("Your new application is ready."))
    }
  
    val pageForm: Form[Page] = Form {
      mapping (
        "url" -&gt; text
      )(Page.apply)(Page.unapply)
    }
  
    def addPage = Action { implicit request =&gt;
      val page = pageForm.bindFromRequest.get
      DB.save(page)
      Redirect(routes.Application.index)
    }
  
    def getPages = Action {
      val page = DB.query[Page].fetch
      Ok(Json.toJson(page))
    }
  }
  </code></pre>
  
  <p>This controller accesses this model:</p>
  
  <pre><code>package models
  
  import java.net.URL
  
  import play.api.libs.json.Json
  
  case class Page(url: String) {
    var content: String = new URL(url).getContent().toString;
  }
  
  object Page {
    implicit val personFormat = Json.format[Page]
  }
  </code></pre>
  
  <p>And is stored in the database like this:</p>
  
  <pre><code>package models
  
  import sorm._
  
  object DB extends Instance(entities = Seq(Entity[Page]()), url="jdbc:h2:mem:test")
  </code></pre>
  
  <p>I create a new instance of the model from the UI like this:</p>
  
  <pre><code> &lt;form action="@routes.Application.addPage" method="post"&gt;
          &lt;input name="url" type="text"&gt;
          &lt;button&gt;Add Page&lt;/button&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>However, when I submit the form from the browser, I get this:</p>
  
  <pre><code>    [error] - play.core.server.netty.PlayDefaultUpstreamHandler - Cannot invoke the action
  java.lang.RuntimeException: java.lang.ExceptionInInitializerError
      at play.api.mvc.ActionBuilder$$anon$1.apply(Action.scala:498) ~[play_2.11-2.4.6.jar:2.4.6]
      at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:105) ~[play_2.11-2.4.6.jar:2.4.6]
      at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:105) ~[play_2.11-2.4.6.jar:2.4.6]
      at play.utils.Threads$.withContextClassLoader(Threads.scala:21) ~[play_2.11-2.4.6.jar:2.4.6]
      at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:104) ~[play_2.11-2.4.6.jar:2.4.6]
      at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:103) ~[play_2.11-2.4.6.jar:2.4.6]
      at scala.Option.map(Option.scala:146) ~[scala-library-2.11.7.jar:na]
      at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:103) ~[play_2.11-2.4.6.jar:2.4.6]
      at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:96) ~[play_2.11-2.4.6.jar:2.4.6]
      at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:524) ~[play-iteratees_2.11-2.4.6.jar:2.4.6]
      at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:524) ~[play-iteratees_2.11-2.4.6.jar:2.4.6]
      at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:560) ~[play-iteratees_2.11-2.4.6.jar:2.4.6]
      at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:560) ~[play-iteratees_2.11-2.4.6.jar:2.4.6]
      at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$14.apply(Iteratee.scala:537) ~[play-iteratees_2.11-2.4.6.jar:2.4.6]
      at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$14.apply(Iteratee.scala:537) ~[play-iteratees_2.11-2.4.6.jar:2.4.6]
      at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) ~[scala-library-2.11.7.jar:na]
      at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) ~[scala-library-2.11.7.jar:na]
      at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40) [akka-actor_2.11-2.3.13.jar:na]
      at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397) [akka-actor_2.11-2.3.13.jar:na]
      at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [scala-library-2.11.7.jar:na]
      at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [scala-library-2.11.7.jar:na]
      at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [scala-library-2.11.7.jar:na]
      at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [scala-library-2.11.7.jar:na]
  Caused by: java.lang.ExceptionInInitializerError: null
  </code></pre>
  
  <p>My <code>build.sbt</code> file:</p>
  
  <pre><code>name := """ScalaWeb"""
  
  version := "1.0-SNAPSHOT"
  
  lazy val root = (project in file(".")).enablePlugins(PlayScala)
  
  scalaVersion := "2.11.7"
  
  libraryDependencies ++= Seq(
    jdbc,
    cache,
    ws,
    specs2 % Test
  )
  
  libraryDependencies ++= Seq(
    "org.sorm-framework" % "sorm" % "0.3.19",
    "org.scala-lang" % "scala-compiler" % scalaVersion.value force(),
    "com.h2database" % "h2" % "1.3.148"
  )
  
  resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"
  
  // Play provides two styles of routers, one expects its actions to be injected, the
  // other, legacy style, accesses its actions statically.
  routesGenerator := InjectedRoutesGenerator
  
  scalacOptions += "-Ylog-classpath"
  </code></pre>
  
  <p>The error message isn't very descriptive. What is wrong about this code?</p>