jaliss / securesocial

A module that provides OAuth, OAuth2 and OpenID authentication for Play Framework applications
http://www.securesocial.ws
Apache License 2.0
1.19k stars 510 forks source link

java.lang.NoSuchFieldError: Assets when running in production #579

Closed risenhoover closed 8 years ago

risenhoover commented 8 years ago

I have a new app that's been running fine in production without SecureSocial. I've been running the app with SecureSocial in a development instance on my laptop as well. However, when I deploy the SecureSocial-enabled app to production, I get the following exception when attempting to access a secured route:

[error] - akka.actor.ActorSystemImpl - Uncaught fatal error from thread [application-akka.actor.default-dispatcher-4] shutting down ActorSystem [application]
java.lang.NoSuchFieldError: Assets
    at securesocial.core.services.RoutesService$Default.valueFor(RoutesService.scala:173) ~[ws.securesocial.securesocial_2.11-master-SNAPSHOT.jar:master-SNAPSHOT]
    at securesocial.core.services.RoutesService$Default.<init>(RoutesService.scala:180) ~[ws.securesocial.securesocial_2.11-master-SNAPSHOT.jar:master-SNAPSHOT]
    at securesocial.core.RuntimeEnvironment$Default.routes$lzycompute(RuntimeEnvironment.scala:54) ~[ws.securesocial.securesocial_2.11-master-SNAPSHOT.jar:master-SNAPSHOT]
    at securesocial.core.RuntimeEnvironment$Default.routes(RuntimeEnvironment.scala:54) ~[ws.securesocial.securesocial_2.11-master-SNAPSHOT.jar:master-SNAPSHOT]
    at securesocial.core.SecureSocial$$anonfun$notAuthenticatedResult$1.applyOrElse(SecureSocial.scala:47) ~[ws.securesocial.securesocial_2.11-master-SNAPSHOT.jar:master-SNAPSHOT]
    at securesocial.core.SecureSocial$$anonfun$notAuthenticatedResult$1.applyOrElse(SecureSocial.scala:45) ~[ws.securesocial.securesocial_2.11-master-SNAPSHOT.jar:master-SNAPSHOT]
    at play.api.mvc.Rendering$render$.play$api$mvc$Rendering$render$$_render$1(Render.scala:34) ~[com.typesafe.play.play_2.11-2.4.3.jar:2.4.3]
    at play.api.mvc.Rendering$render$.apply(Render.scala:40) ~[com.typesafe.play.play_2.11-2.4.3.jar:2.4.3]
    at securesocial.core.SecureSocial$class.notAuthenticatedResult(SecureSocial.scala:45) ~[ws.securesocial.securesocial_2.11-master-SNAPSHOT.jar:master-SNAPSHOT]
    at controllers.SecuredApplication.notAuthenticatedResult(SecuredApplication.scala:11) ~[fintel.fintel-1.0-SNAPSHOT-sans-externalized.jar:2.4.3]
    at securesocial.core.SecureSocial$SecuredActionBuilder$$anonfun$invokeSecuredBlock$1.apply(SecureSocial.scala:115) ~[ws.securesocial.securesocial_2.11-master-SNAPSHOT.jar:master-SNAPSHOT]
    at securesocial.core.SecureSocial$SecuredActionBuilder$$anonfun$invokeSecuredBlock$1.apply(SecureSocial.scala:98) ~[ws.securesocial.securesocial_2.11-master-SNAPSHOT.jar:master-SNAPSHOT]
    at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:251) ~[org.scala-lang.scala-library-2.11.7.jar:na]
    at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:249) ~[org.scala-lang.scala-library-2.11.7.jar:na]
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32) ~[org.scala-lang.scala-library-2.11.7.jar:na]
    at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55) ~[com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
    at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:91) ~[com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
    at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91) ~[com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
    at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91) ~[com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
    at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72) ~[org.scala-lang.scala-library-2.11.7.jar:na]
    at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:90) ~[com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40) ~[com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397) [com.typesafe.akka.akka-actor_2.11-2.3.13.jar:na]
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [org.scala-lang.scala-library-2.11.7.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [org.scala-lang.scala-library-2.11.7.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [org.scala-lang.scala-library-2.11.7.jar:na]
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [org.scala-lang.scala-library-2.11.7.jar:na]

My SecuredApplication is declared as follows. Line 11 (the line with the exception in the stack trace above) is this declaration line.

class SecuredApplication @Inject() (override implicit val env: MyEnvironment) extends Controller with securesocial.core.SecureSocial{

}
risenhoover commented 8 years ago

It looks like I had a bunch of extra routes that were unnecessary. I commented all of them out and the problem has gone away.

saliljnr commented 8 years ago

@risenhoover , i have same problem like you. Which routes exactly did you get rid of?

risenhoover commented 8 years ago

I removed all routes that referenced securesocial.* except for the "-> /auth" route.

saliljnr commented 8 years ago

@risenhoover Thanks man! That fixed my issue too.. Beats me why I thought it necessary to include the routes manually in the first place. Phew! Saved my @$$!