I have the error when doing migration from Play version 2.5 to 2.6.
Here is list of actions I've applied:
sbt clean
sbt compile
sbt update
sbt eclipse
I got this exception
ProvisionException: Unable to provision, see the following errors:
1) Error injecting constructor, java.lang.NoClassDefFoundError: org/pac4j/play/scala/Security$class at controllers.EntityController.(EntityController.scala:50) at controllers.EntityController.class(EntityController.scala:50) while locating controllers.EntityController for the 4th parameter of router.Routes.(Routes.scala:50) while locating router.Routes while locating play.api.inject.RoutesProvider while locating play.api.routing.Router for the 1st parameter of play.api.http.JavaCompatibleHttpRequestHandler.(HttpRequestHandler.scala:222) while locating play.api.http.JavaCompatibleHttpRequestHandler while locating play.api.http.HttpRequestHandler for the 6th parameter of play.api.DefaultApplication.(Application.scala:236) at play.api.DefaultApplication.class(Application.scala:235) while locating play.api.DefaultApplication while locating play.api.Application Caused by: java.lang.NoClassDefFoundError: org/pac4j/play/scala/Security$class at controllers.EntityController.(EntityController.scala:60) at controllers.EntityController$$FastClassByGuice$$f46ad4b6.newInstance() at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89) at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:111) at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:90) at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:268) at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46) at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092) at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:194) at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41) at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38) at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62) at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:110) at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:90) at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:268) at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1019) at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092) at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1015) at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1054) at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:409) at play.api.inject.ContextClassLoaderInjector$$anonfun$instanceOf$3.apply(Injector.scala:118) at play.api.inject.ContextClassLoaderInjector.withContext(Injector.scala:126) at play.api.inject.ContextClassLoaderInjector.instanceOf(Injector.scala:118) at play.api.inject.RoutesProvider$$anonfun$2.apply(BuiltinModule.scala:104) at play.api.inject.RoutesProvider$$anonfun$2.apply(BuiltinModule.scala:104) at scala.Option.fold(Option.scala:158) at play.api.inject.RoutesProvider.get$lzycompute(BuiltinModule.scala:104) at play.api.inject.RoutesProvider.get(BuiltinModule.scala:100) at play.api.inject.RoutesProvider.get(BuiltinModule.scala:99) at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81) at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72) at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61) at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:62) at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38) at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62) at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:110) at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:90) at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:268) at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56) at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38) at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62) at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:110) at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:90) at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:268) at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46) at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092) at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:194) at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41) at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56) at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1019) at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1085) at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1015) at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1054) at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:409) at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:404) at play.api.inject.ContextClassLoaderInjector$$anonfun$instanceOf$2.apply(Injector.scala:117) at play.api.inject.ContextClassLoaderInjector.withContext(Injector.scala:126) at play.api.inject.ContextClassLoaderInjector.instanceOf(Injector.scala:117) at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:137) at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21) at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$1.apply(DevServerStart.scala:174) at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$1.apply(DevServerStart.scala:171) at play.utils.Threads$.withContextClassLoader(Threads.scala:21) at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1.reload(DevServerStart.scala:171) at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1.get(DevServerStart.scala:124) at play.core.server.AkkaHttpServer.play$core$server$AkkaHttpServer$$modelConversion(AkkaHttpServer.scala:183) at play.core.server.AkkaHttpServer.play$core$server$AkkaHttpServer$$handleRequest(AkkaHttpServer.scala:189) at play.core.server.AkkaHttpServer$$anonfun$5.apply(AkkaHttpServer.scala:106) at play.core.server.AkkaHttpServer$$anonfun$5.apply(AkkaHttpServer.scala:106) at akka.stream.impl.fusing.MapAsync$$anon$23.onPush(Ops.scala:1172) at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:499) at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:462) at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:368) at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:571) at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:457) at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:546) at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:725) at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:740) at akka.actor.Actor$class.aroundReceive(Actor.scala:514) at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:650) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:527) at akka.actor.ActorCell.invoke(ActorCell.scala:496) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257) at akka.dispatch.Mailbox.run(Mailbox.scala:224) at akka.dispatch.Mailbox.exec(Mailbox.scala:234) at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) Caused by: java.lang.ClassNotFoundException: org.pac4j.play.scala.Security$class at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 91 more
The class that use the Security is this
@Singleton
class EntityController @Inject() (val controllerComponents: ControllerComponents,
val config: Config,
val entities: EntityRepository,
val configextractor: ConfigExtractor,
val calendars: CalendarRepository,
val kpis: KpiExtractor,
val authz: EntityAuthorizer,
val playSessionStore: PlaySessionStore,
val searchService: SearchService,
implicit val ec: ComputeExecutionContext
) extends BaseController with Security[CommonProfile] with KpiAware{
I wrote the file sbt.
name := """fons"""
organization := "com.luxottica.retail"
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.11.8"
// Dependencies
libraryDependencies ++= Seq(
ws,
filters,
cacheApi,
openId,
guice,
"commons-io" % "commons-io" % "2.5",
"com.github.romix.akka" %% "akka-kryo-serialization" % "0.5.0",
"com.github.simonedeponti" %% "play26-lettuce" % "0.1",
"joda-time" % "joda-time" % "2.9.9",
"org.mongodb.scala" %% "mongo-scala-driver" % "2.1.0",
"org.pac4j" % "play-pac4j" % "4.0.0",
"org.pac4j" % "pac4j-core" % "2.1.0",
"org.pac4j" % "pac4j-http" % "2.1.0",
"org.pac4j" % "pac4j-jwt" % "2.1.0" exclude("commons-io" , "commons-io"),
"org.pac4j" % "pac4j-ldap" % "2.1.0",
"com.microsoft.azure" % "applicationinsights-core" % "1.0.10",
"com.microsoft.azure" % "applicationinsights-logging-logback" % "1.0.10",
"com.github.t3hnar" %% "scala-bcrypt" % "3.0",
"org.scalariform" %% "scalariform" % "0.2.3"
)
// Test dependencies
libraryDependencies ++= Seq(
"org.scalatestplus.play" %% "scalatestplus-play" % "2.0.0" % Test,
"org.mockito" % "mockito-all" % "1.10.19" % Test,
"junit" % "junit" % "4.12" % Test,
"org.scalaz" %% "scalaz-core" % "7.1.1" % Test
)
resolvers ++= Seq(
"snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
"releases" at "http://oss.sonatype.org/content/repositories/releases",
"Scalaz Bintray Repo" at "http://dl.bintray.com/scalaz/releases",
"Simone's repos" at "https://dl.bintray.com/simonedeponti/maven"
)
routesGenerator := InjectedRoutesGenerator
scalacOptions += "-deprecation"
evictionWarningOptions in update := EvictionWarningOptions.default.withWarnTransitiveEvictions(false)
// Adds additional packages into Twirl
//TwirlKeys.templateImports += "com.luxottica.retail.controllers._"
// Adds additional packages into conf/routes
// play.sbt.routes.RoutesKeys.routesImport += "com.luxottica.retail.binders._"
assemblyMergeStrategy in assembly := {
case m if m.toLowerCase.endsWith("manifest.mf") => MergeStrategy.discard
case m if m.toLowerCase.matches("meta-inf.*\\.sf$") => MergeStrategy.discard
case "log4j.properties" => MergeStrategy.discard
case m if m.toLowerCase.startsWith("meta-inf/services/") => MergeStrategy.filterDistinctLines
case "reference.conf" => MergeStrategy.concat
case _ => MergeStrategy.first
}
What have to change??