swagger-play
swagger-play copied to clipboard
Provider io.swagger.scala.converter.SwaggerScalaModelConverter could not be instantiated at play.modules.swagger.SwaggerPluginImpl
I am using play 2.6.10 and swagger-play 1.6.0 `play.api.UnexpectedException: Unexpected exception[CreationException: Unable to create injector, see the following errors:
- Error injecting constructor, java.util.ServiceConfigurationError: io.swagger.converter.ModelConverter: Provider io.swagger.scala.converter.SwaggerScalaModelConverter could not be instantiated
at play.modules.swagger.SwaggerPluginImpl.
(SwaggerPlugin.scala:35) while locating play.modules.swagger.SwaggerPluginImpl at play.modules.swagger.SwaggerModule.bindings(SwaggerModule.scala:11): Binding(interface play.modules.swagger.SwaggerPlugin to ConstructionTarget(class play.modules.swagger.SwaggerPluginImpl) eagerly) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1) while locating play.modules.swagger.SwaggerPlugin
1 error] at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1.reload(DevServerStart.scala:186) 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$24.onPush(Ops.scala:1191) at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:512) at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:475) at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:371) Caused by: com.google.inject.CreationException: Unable to create injector, see the following errors:
- Error injecting constructor, java.util.ServiceConfigurationError: io.swagger.converter.ModelConverter: Provider io.swagger.scala.converter.SwaggerScalaModelConverter could not be instantiated
at play.modules.swagger.SwaggerPluginImpl.
(SwaggerPlugin.scala:35) while locating play.modules.swagger.SwaggerPluginImpl at play.modules.swagger.SwaggerModule.bindings(SwaggerModule.scala:11): Binding(interface play.modules.swagger.SwaggerPlugin to ConstructionTarget(class play.modules.swagger.SwaggerPluginImpl) eagerly) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1) while locating play.modules.swagger.SwaggerPlugin
1 error
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:470)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:184)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
at com.google.inject.Guice.createInjector(Guice.java:99)
at com.google.inject.Guice.createInjector(Guice.java:84)
at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:185)
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)
Caused by: java.util.ServiceConfigurationError: io.swagger.converter.ModelConverter: Provider io.swagger.scala.converter.SwaggerScalaModelConverter could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:232)
at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
at java.util.ServiceLoader$LazyIterator.access$700(ServiceLoader.java:323)
at java.util.ServiceLoader$LazyIterator$2.run(ServiceLoader.java:407)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:409)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at io.swagger.converter.ModelConverters.
I have a similar problem, which may could have the same cause.
I am using play 2.6.11 and swagger-play 1.6.0
It looks like the newInstance method fails for the class SwaggerScalaModelConverter for some reason.
The problem occurs after adding the following dependency to my build.sbt file:
libraryDependencies += "com.auth0" % "java-jwt" % "3.3.0"
After removing the line, swagger-play works again. There have been no other changes to my codebase beside of this line.
java.util.ServiceConfigurationError: io.swagger.converter.ModelConverter: Provider io.swagger.scala.converter.SwaggerScalaModelConverter could not be instantiated java.util.ServiceLoader.fail(ServiceLoader.java:232) java.util.ServiceLoader.access$100(ServiceLoader.java:185) java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384) java.util.ServiceLoader$LazyIterator.access$700(ServiceLoader.java:323) java.util.ServiceLoader$LazyIterator$2.run(ServiceLoader.java:407) java.security.AccessController.doPrivileged(Native Method) java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:409) java.util.ServiceLoader$1.next(ServiceLoader.java:480) io.swagger.converter.ModelConverters.<clinit>(ModelConverters.java:114) play.modules.swagger.PlayReader.parseMethod(PlayReader.java:487) play.modules.swagger.PlayReader.read(PlayReader.java:139) play.modules.swagger.PlayReader.read(PlayReader.java:63) play.modules.swagger.PlayReader.read(PlayReader.java:57) play.modules.swagger.ApiListingCache$.$anonfun$listing$1(ApiListingCache.scala:17) scala.Option.orElse(Option.scala:289) play.modules.swagger.ApiListingCache$.listing(ApiListingCache.scala:11) play.modules.swagger.SwaggerPluginImpl.<init>(SwaggerPlugin.scala:164) SwaggerComponents.$init$(SwaggerComponents.scala:6) Launcher$$anon$1.<init>(Launcher.scala:6) Launcher.load(Launcher.scala:6) play.core.server.DevServerStart$$anon$1.$anonfun$reload$3(DevServerStart.scala:174) play.utils.Threads$.withContextClassLoader(Threads.scala:21) play.core.server.DevServerStart$$anon$1.reload(DevServerStart.scala:171) play.core.server.DevServerStart$$anon$1.get(DevServerStart.scala:124) play.core.server.AkkaHttpServer.modelConversion(AkkaHttpServer.scala:183) play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:189) play.core.server.AkkaHttpServer.$anonfun$createServerBinding$1(AkkaHttpServer.scala:106) akka.stream.impl.fusing.MapAsync$$anon$24.onPush(Ops.scala:1191) akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:512) akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:475) akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:371) akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:584) akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:468) akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:559) akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:741) akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:756) akka.actor.Actor.aroundReceive(Actor.scala:517) akka.actor.Actor.aroundReceive$(Actor.scala:515) akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:666) akka.actor.ActorCell.receiveMessage(ActorCell.scala:527) akka.actor.ActorCell.invoke(ActorCell.scala:496) akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257) akka.dispatch.Mailbox.run(Mailbox.scala:224) akka.dispatch.Mailbox.exec(Mailbox.scala:234) akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)