Open brajkannan opened 8 years ago
Is that the full stacktrace? I hit on a similar issue recently so I might be able to help, please post the full stacktrace and example repo if possible.
I face the same issue. I just follow the document,
@skanel Can you send me the link for that document?
https://github.com/swagger-api/swagger-samples/tree/master/scala/scala-play2.4
it just works with play 2.4 and "io.swagger" %% "swagger-play2" % "1.5.2",
You can download project and run,to see it works
please tell me how to solve this.
Use 1.5.2 instead of 1.5.2-SNAPSHOT.
I am aso facing the same issue. I am using Paly 2.4 and Swagger Play "io.swagger" %% "swagger-play2" % "1.5.2",
The error I am getting is.
! @76allc03i - Internal server error, for (GET) [/health] ->
play.api.UnexpectedException: Unexpected exception[CreationException: Unable to create injector, see the following errors:
1) Error injecting constructor, java.lang.ExceptionInInitializerError
at play.modules.swagger.SwaggerPluginImpl.
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.6.jar:2.4.6] 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.6.jar:2.4.6] at scala.Option.map(Option.scala:146) ~[scala-library-2.11.7.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.6.jar:2.4.6] 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.6.jar:2.4.6] at scala.util.Success.flatMap(Try.scala:231) ~[scala-library-2.11.7.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.6.jar:2.4.6] at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:111) ~[play-server_2.11-2.4.6.jar:2.4.6] at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) ~[scala-library-2.11.7.jar:na] at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) ~[scala-library-2.11.7.jar:na] at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402) ~[na:1.8.0_121] at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[na:1.8.0_121] at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) ~[na:1.8.0_121] at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) ~[na:1.8.0_121] at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) ~[na:1.8.0_121] Caused by: com.google.inject.CreationException: Unable to create injector, see the following errors:
1) Error injecting constructor, java.lang.ExceptionInInitializerError
at play.modules.swagger.SwaggerPluginImpl.
1 error
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:466) ~[guice-4.0.jar:na]
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:184) ~[guice-4.0.jar:na]
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110) ~[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.6.jar:2.4.6]
at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:93) ~[play_2.11-2.4.6.jar:2.4.6]
at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21) ~[play_2.11-2.4.6.jar:2.4.6]
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.6.jar:2.4.6]
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:150) ~[play-server_2.11-2.4.6.jar:2.4.6]
at play.utils.Threads$.withContextClassLoader(Threads.scala:21) ~[play_2.11-2.4.6.jar:2.4.6]
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:150) ~[play-server_2.11-2.4.6.jar:2.4.6]
... 14 common frames omitted
Caused by: java.lang.ExceptionInInitializerError: null
at java.lang.Class.forName0(Native Method) ~[na:1.8.0_121]
at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_121]
at play.modules.swagger.util.SwaggerContext$$anonfun$loadClass$1.apply(SwaggerContext.scala:27) ~[swagger-play2_2.11-1.5.2.jar:1.5.2]
at play.modules.swagger.util.SwaggerContext$$anonfun$loadClass$1.apply(SwaggerContext.scala:24) ~[swagger-play2_2.11-1.5.2.jar:1.5.2]
at scala.collection.immutable.List.foreach(List.scala:381) ~[scala-library-2.11.7.jar:na]
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35) ~[scala-library-2.11.7.jar:na]
at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45) ~[scala-library-2.11.7.jar:na]
at play.modules.swagger.util.SwaggerContext$.loadClass(SwaggerContext.scala:24) ~[swagger-play2_2.11-1.5.2.jar:1.5.2]
at play.modules.swagger.PlayApiScanner$$anonfun$1.applyOrElse(PlayApiScanner.scala:86) ~[swagger-play2_2.11-1.5.2.jar:1.5.2]
at play.modules.swagger.PlayApiScanner$$anonfun$1.applyOrElse(PlayApiScanner.scala:83) ~[swagger-play2_2.11-1.5.2.jar:1.5.2]
at scala.collection.immutable.List.collect(List.scala:295) ~[scala-library-2.11.7.jar:na]
at play.modules.swagger.PlayApiScanner.classes(PlayApiScanner.scala:83) ~[swagger-play2_2.11-1.5.2.jar:1.5.2]
at play.modules.swagger.ApiListingCache$$anonfun$listing$1.apply(ApiListingCache.scala:15) ~[swagger-play2_2.11-1.5.2.jar:1.5.2]
at play.modules.swagger.ApiListingCache$$anonfun$listing$1.apply(ApiListingCache.scala:11) ~[swagger-play2_2.11-1.5.2.jar:1.5.2]
at scala.Option.orElse(Option.scala:289) ~[scala-library-2.11.7.jar:na]
at play.modules.swagger.ApiListingCache$.listing(ApiListingCache.scala:11) ~[swagger-play2_2.11-1.5.2.jar:1.5.2]
at play.modules.swagger.SwaggerPluginImpl.
I have added "io.swagger" %% "swagger-play2" % "1.5.2" in build.sbt and added swaggermodule as well in application.conf and am getting error that, unable to inject constructor
Error:
1) Error injecting constructor, java.lang.ExceptionInInitializerError at play.modules.swagger.SwaggerPluginImpl.<init>(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$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:165) ~[play-server_2.11-2.4.6.jar:2.4.6] 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.6.jar:2.4.6] at scala.Option.map(Option.scala:146) ~[scala-library-2.11.7.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.6.jar:2.4.6] 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.6.jar:2.4.6] at scala.util.Success.flatMap(Try.scala:231) ~[scala-library-2.11.7.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.6.jar:2.4.6] at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:111) ~[play-server_2.11-2.4.6.jar:2.4.6] at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) ~[scala-library-2.11.7.jar:na] at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) ~[scala-library-2.11.7.jar:na] at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402) ~[na:1.8.0_65] at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[na:1.8.0_65] at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) ~[na:1.8.0_65] at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) ~[na:1.8.0_65] at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) ~[na:1.8.0_65] Caused by: com.google.inject.CreationException: Unable to create injector, see the following errors:
Can the team help me to fix this problem?