title: Play app can't run after adding scalacOptions in SBT
body: <p>I've added these Scalac options in my SBT build:</p>
  
  <pre><code>scalacOptions ++= Seq("-unchecked", "-deprecation","-feature"),
  </code></pre>
  
  <p>But then I can't access my Play 2.1 web application anymore.</p>
  
  <p>It is the only modified part of my build, and if I remove this, it works fine again.</p>
  
  <p>It's weird because the application seems to be running (I see startup logs, scheduled jobs...), but trying to access it from the browser gives me Play error page:</p>
  
  <pre><code>Cannot init the Global object
  No source available, here is the exception stack trace:
  -&gt;java.lang.ExceptionInInitializerError: 
       Global$.&lt;init&gt;(Global.scala:17)
       Global$.&lt;clinit&gt;(Global.scala)
       sun.misc.Unsafe.ensureClassInitialized(Native Method)
       sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43)
       sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:140)
       java.lang.reflect.Field.acquireFieldAccessor(Field.java:949)
       java.lang.reflect.Field.getFieldAccessor(Field.java:930)
       java.lang.reflect.Field.get(Field.java:372)
       play.api.WithDefaultGlobal$class.play$api$WithDefaultGlobal$$scalaGlobal(Application.scala:37)
       play.api.DefaultApplication.play$api$WithDefaultGlobal$$scalaGlobal$lzycompute(Application.scala:383)
       play.api.DefaultApplication.play$api$WithDefaultGlobal$$scalaGlobal(Application.scala:383)
       play.api.WithDefaultGlobal$$anonfun$play$api$WithDefaultGlobal$$globalInstance$1$$anonfun$apply$5.apply(Application.scala:52)
       play.api.WithDefaultGlobal$$anonfun$play$api$WithDefaultGlobal$$globalInstance$1$$anonfun$apply$5.apply(Application.scala:52)
       scala.Option.getOrElse(Option.scala:120)
       play.api.WithDefaultGlobal$$anonfun$play$api$WithDefaultGlobal$$globalInstance$1.apply(Application.scala:52)
       play.api.WithDefaultGlobal$$anonfun$play$api$WithDefaultGlobal$$globalInstance$1.apply(Application.scala:51)
       play.utils.Threads$.withContextClassLoader(Threads.scala:18)
       play.api.WithDefaultGlobal$class.play$api$WithDefaultGlobal$$globalInstance(Application.scala:50)
       play.api.DefaultApplication.play$api$WithDefaultGlobal$$globalInstance$lzycompute(Application.scala:383)
       play.api.DefaultApplication.play$api$WithDefaultGlobal$$globalInstance(Application.scala:383)
       play.api.WithDefaultGlobal$class.global(Application.scala:66)
       play.api.DefaultApplication.global(Application.scala:383)
       play.api.WithDefaultConfiguration$class.play$api$WithDefaultConfiguration$$fullConfiguration(Application.scala:80)
       play.api.DefaultApplication.play$api$WithDefaultConfiguration$$fullConfiguration$lzycompute(Application.scala:383)
       play.api.DefaultApplication.play$api$WithDefaultConfiguration$$fullConfiguration(Application.scala:383)
       play.api.WithDefaultConfiguration$class.configuration(Application.scala:82)
       play.api.DefaultApplication.configuration(Application.scala:383)
       play.api.Application$class.$init$(Application.scala:268)
       play.api.DefaultApplication.&lt;init&gt;(Application.scala:383)
       play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anon$1.&lt;init&gt;(ApplicationProvider.scala:128)
       play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:128)
       play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:114)
       scala.Option.map(Option.scala:145)
       play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:114)
       play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:112)
       scala.util.Either$RightProjection.flatMap(Either.scala:523)
       play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:112)
       play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:104)
       scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
       scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
       java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
       java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
       java.lang.Thread.run(Thread.java:722)
  </code></pre>
  
  <p>My Global.scala looks like this:</p>
  
  <pre><code>object Global extends GlobalSettings {
  
    // TODO use cake pattern injection?
    val searchService: SearchService = StampleApplication.get.searchService
    val breadcrumbService: BreadcrumbService = StampleApplication.get.breadcrumbService
  
    override def onStart(app: Application) {
      Logger.info("Application has started")
      startElasticSearchIndexationScheduling
      startBreadcrumbUpdaterJob
    }
  
    override def onStop(app: Application) {
      Logger.info("Application shutdown...")
    }
  
  
  
    // TODO externaliser delais des jobs dans la conf play?
  
    def startElasticSearchIndexationScheduling = {
      Akka.system.scheduler.schedule(30 seconds , 30 seconds) {
        Logger.info("Indexation job triggered")
        searchService.indexUnindexedStamples
        searchService.indexUnindexedUsers
      }
    }
  
    def startBreadcrumbUpdaterJob = {
      Akka.system.scheduler.schedule(30 seconds, 30 seconds) {
        Logger.info("Breadcrumb updated job triggered")
        breadcrumbService.updateChildsBreadcrumbForFlaggedCategories
        Logger.info("Breadcrumb updated (with recursion!) job triggered")
        breadcrumbService.recompteAllFlaggedWithRecursion
      }
    }
  
  
  
  }
  </code></pre>
  
  <p>The Global$.(Global.scala:17) seems to reference this line:</p>
  
  <pre><code>val searchService: SearchService = StampleApplication.get.searchService
  </code></pre>
  
  <p>The rest of the sources are:</p>
  
  <pre><code>object StampleApplication {
  
    val get: CakeApplication = {
      println("Building stample cake application")
      // Inject properties here
      new CakeConfiguration().buildApplication
    }
  
  }
  
  trait CakeApplication
    extends ServiceLayer
    with RepositoryLayer
  
  
  trait ServiceLayer
    extends RepositoryLayer
    with DefaultUserServiceComponent
    with DefaultCategoryServiceComponent
    with DefaultStampleServiceComponent
    with DefaultAclServiceComponent
    with DefaultFileServiceComponent
    with DefaultApiCallServiceComponent
    with DefaultBreadcrumbServiceComponent
    with DefaultSearchServiceComponent
    with DefaultRelationshipServiceComponent
    with DefaultSharingServiceComponent
    with DefaultAuthCodeServiceComponent
    with DefaultNotificationServiceComponent
    with DefaultEventServiceComponent
    with DefaultCommentServiceComponent
  
  
  trait RepositoryLayer
    extends MongoUserRepositoryComponent
    with MongoCategoryRepositoryComponent
    with MongoCategorySharingRepositoryComponent
    with MongoStampleRepositoryComponent
    with MongoFileRepositoryComponent
    with MongoApiCallRepositoryComponent
    with MongoRelationshipRepositoryComponent
    with MongoSharingRepositoryComponent
    with MongoNotificationRepositoryComponent
  
    with SalatDAOFactoryComponent
    with CollectionProviderComponent
  
  trait CollectionProviderComponent {
    def collectionProvider:MongoCollectionProvider
  }
  </code></pre>