joscha / play-authenticate

An authentication plugin for Play Framework 2.x (Java)
http://joscha.github.com/play-authenticate/
Other
807 stars 366 forks source link

2.4 Sample not working #262

Closed oexza closed 9 years ago

oexza commented 9 years ago

tried to run the 0.7.0 snapshot play-authenticate-usage sample it throws this exception

play.api.UnexpectedException: Unexpected exception[CreationException: Unable to create injector, see the following errors:

1) No implementation for be.objectify.deadbolt.java.cache.HandlerCache was bound. while locating be.objectify.deadbolt.java.cache.HandlerCache for parameter 3 at be.objectify.deadbolt.java.ViewSupport.(ViewSupport.java:70) at be.objectify.deadbolt.java.DeadboltModule.bindings(DeadboltModule.java:27): Binding(class be.objectify.deadbolt.java.ViewSupport to self in interface javax.inject.Singleton) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)

1 error] at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:165) ~[play-server_2.11-2.4.0.jar:2.4.0] at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:121) ~[play-server_2.11-2.4.0.jar:2.4.0] at scala.Option.map(Option.scala:146) ~[scala-library-2.11.6.jar:na] at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:121) ~[play-server_2.11-2.4.0.jar:2.4.0] at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:119) ~[play-server_2.11-2.4.0.jar:2.4.0] at scala.util.Success.flatMap(Try.scala:230) ~[scala-library-2.11.6.jar:na] at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:119) ~[play-server_2.11-2.4.0.jar:2.4.0] at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:111) ~[play-server_2.11-2.4.0.jar:2.4.0] at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) ~[scala-library-2.11.6.jar:na] at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) ~[scala-library-2.11.6.jar:na] Caused by: com.google.inject.CreationException: Unable to create injector, see the following errors:

1) No implementation for be.objectify.deadbolt.java.cache.HandlerCache was bound. while locating be.objectify.deadbolt.java.cache.HandlerCache for parameter 3 at be.objectify.deadbolt.java.ViewSupport.(ViewSupport.java:70) at be.objectify.deadbolt.java.DeadboltModule.bindings(DeadboltModule.java:27): Binding(class be.objectify.deadbolt.java.ViewSupport to self in interface javax.inject.Singleton) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)

1 error at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:466) ~[guice-4.0.jar:na] at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155) ~[guice-4.0.jar:na] at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107) ~[guice-4.0.jar:na] at com.google.inject.Guice.createInjector(Guice.java:96) ~[guice-4.0.jar:na] at com.google.inject.Guice.createInjector(Guice.java:73) ~[guice-4.0.jar:na] at com.google.inject.Guice.createInjector(Guice.java:62) ~[guice-4.0.jar:na] at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:126) ~[play_2.11-2.4.0.jar:2.4.0] at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:93) ~[play_2.11-2.4.0.jar:2.4.0] at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21) ~[play_2.11-2.4.0.jar:2.4.0] at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:153) ~[play-server_2.11-2.4.0.jar:2.4.0]

joscha commented 9 years ago

@schaloner do you have any idea?

mkurz commented 9 years ago

You have to enable the deadbolt module in application.conf

oexza commented 9 years ago

@mkurz if you mean this play { modules { enabled += "be.objectify.deadbolt.java.DeadboltModule" } }

then it is enabled but i get the same error

schaloner commented 9 years ago

@oexza @mkurz @joscha There's slightly more to it than that. Take a look at the quickstart guide: https://github.com/schaloner/deadbolt-2-java/blob/master/QuickStart.md

It comes down to - instead of defining handlers in application.conf and having them created via reflection, instead you implement your own HandlerCache with whatever handlers defined or injected in to. This is then declared as a second module. It's all documented in the guide, but let me know if you have any issues.

mkurz commented 9 years ago

This issue is fixed with #263.

joscha commented 9 years ago

thanks @mkurz and @schaloner