arcane86 / ReactiveCouchbase-SecureSocial-Sample

This application is an example of SecureSocial integration in Play! Scala backed up by Couchbase using Reactive Couchbase driver.
Other
4 stars 2 forks source link

ExceptionInInitializerError on startup #1

Open gmarizy opened 10 years ago

gmarizy commented 10 years ago

How I reproduce this error:

At this point I get this error:

[error] application -

! @6h93mcjma - Internal server error, for (GET) [/] ->

play.api.UnexpectedException: Unexpected exception[ExceptionInInitializerError: null] at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:152) ~[play_2.10-2.2.1.jar:2.2.1] at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:112) ~[play_2.10-2.2.1.jar:2.2.1] at scala.Option.map(Option.scala:145) ~[scala-library.jar:na] at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:112) ~[play_2.10-2.2.1.jar:2.2.1] at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:110) ~[play_2.10-2.2.1.jar:2.2.1] at scala.util.Success.flatMap(Try.scala:200) ~[scala-library.jar:na] Caused by: java.lang.ExceptionInInitializerError: null at Routes$.setPrefix(routes_routing.scala:21) ~[na:na] at play.api.Application$$anonfun$loadRoutes$3.apply(Application.scala:247) ~[play_2.10-2.2.1.jar:2.2.1] at play.api.Application$$anonfun$loadRoutes$3.apply(Application.scala:246) ~[play_2.10-2.2.1.jar:2.2.1] at scala.Option.map(Option.scala:145) ~[scala-library.jar:na] at play.api.Application$class.loadRoutes(Application.scala:246) ~[play_2.10-2.2.1.jar:2.2.1] at play.api.DefaultApplication.loadRoutes(Application.scala:399) ~[play_2.10-2.2.1.jar:2.2.1] Caused by: java.lang.NullPointerException: null at Models.UserController$$anonfun$15.apply(User.scala:81) ~[na:na] at Models.UserController$$anonfun$15.apply(User.scala:80) ~[na:na] at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) ~[scala-library.jar:na] at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) ~[scala-library.jar:na] at scala.collection.immutable.List.foreach(List.scala:318) ~[scala-library.jar:na] at scala.collection.TraversableLike$class.map(TraversableLike.scala:244) ~[scala-library.jar:na]

I tried to configure the project, nothing changed: securesocial.conf : changed smtp config, removed twitter, google and facebook sections play.plugins : removed twitter, facebook and google providers configured couchbase.conf

I also tried to change version of reactiveCouchbase, to 0.1 release or 0.2-snapshot.

gmarizy commented 10 years ago

I don't understand the problem, but I finally found a workaround:

/**
 * The CRUD controller for User.
 */
object UserController extends CouchbaseCrudSourceController[User] {

    // Get all existing buckets (alias + name) from configuration
    //    case class Bucket(alias: String, name: String)
    //    private val buckets: List[Bucket] = Play.current.configuration.getObjectList("couchbase.buckets").get.toList.map(b =>
    //        Bucket(b.get("alias").unwrapped.toString, b.get("bucket").unwrapped.toString)
    //    )

    // Get the bucket for this controller
    val bucketAlias: String = "users"
    //    def bucket = PlayCouchbase.bucket(buckets.foldRight("default")((b, n) => {
    //        if (b.alias == bucketAlias) b.name else n
    //    }))
      def bucket = PlayCouchbase.bucket(bucketAlias)

    val viewPrefix = if (Play.isDev) "dev_" else ""
    override def defaultViewName = "by_idKey"
    override def defaultDesignDocname = s"${viewPrefix}${bucketAlias}"
    override def idKey = "idKey"
}