Open shayhz opened 7 years ago
Same problem here.
(the play version is 2.5.9, the swagger version is 1.5.3 and my project is with sub modules)
+1, it doesn't work for play 2.5 for us neither. Any help? Anyone managed to run this?
swagger-play 1.5.3 works fine with play 2.5.3
Still got the error if I use swagger-play 1.5.3 with play 2.5.3 play.api.UnexpectedException: Unexpected exception[CreationException: Unable to create injector, see the following errors:
1) Error injecting constructor, java.lang.NullPointerException
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:170) at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:126) at scala.Option.map(Option.scala:146) at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:126) at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:124) at scala.util.Success.flatMap(Try.scala:231) at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:124) at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:116) at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) Caused by: com.google.inject.CreationException: Unable to create injector, see the following errors:
1) Error injecting constructor, java.lang.NullPointerException
at play.modules.swagger.SwaggerPluginImpl.
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:181)
at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:158)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:155)
Caused by: java.lang.NullPointerException: null
at java.io.Reader.
I'm seeing similar problems with swagger-play 1.5.3 and Play 2.5.14.
I'm reporting the same exact error as @sshanamplify using swagger-play 1.5.3 and Play 2.5.13
play.api.UnexpectedException: Unexpected exception[CreationException: Unable to create injector, see the following errors:
1) Error injecting constructor, java.lang.NullPointerException
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:180) at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:131) at scala.Option.map(Option.scala:146) at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:131) at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:129) at scala.util.Success.flatMap(Try.scala:231) at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:129) at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:121) at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) Caused by: com.google.inject.CreationException: Unable to create injector, see the following errors:
1) Error injecting constructor, java.lang.NullPointerException
at play.modules.swagger.SwaggerPluginImpl.
1 error
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:466)
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:96)
at com.google.inject.Guice.createInjector(Guice.java:84)
at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:181)
at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:168)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:164)
Caused by: java.lang.NullPointerException: null
at java.io.Reader.
I am getting this error as well. Any solution?
1) Error injecting constructor, java.lang.NullPointerException
at play.modules.swagger.SwaggerPluginImpl.
1 error
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:466)
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:96)
at com.google.inject.Guice.createInjector(Guice.java:84)
at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:181)
at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:168)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:164)
Caused by: java.lang.NullPointerException: null
at java.io.Reader.
I'm getting this on play 2.5.18 and swagger-play2 1.5.3:
CreationException: Unable to create injector, see the following errors:
1) Error injecting constructor, java.lang.NullPointerException
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
...
ffs | 1) Error injecting constructor, java.lang.NullPointerException
ffs | at play.modules.swagger.SwaggerPluginImpl.<init>(SwaggerPlugin.scala:35)
ffs | while locating play.modules.swagger.SwaggerPluginImpl
ffs | at play.modules.swagger.SwaggerModule.bindings(SwaggerModule.scala:11):
ffs | 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)
ffs | while locating play.modules.swagger.SwaggerPlugin
ffs |
ffs | 1 error
ffs | at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:470)
ffs | at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:184)
ffs | at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
ffs | at com.google.inject.Guice.createInjector(Guice.java:99)
ffs | at com.google.inject.Guice.createInjector(Guice.java:84)
ffs | at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:181)
ffs | at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
ffs | at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
ffs | at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:168)
ffs | at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:164)
ffs | Caused by: java.lang.NullPointerException: null
ffs | at java.io.Reader.<init>(Reader.java:78)
ffs | at java.io.InputStreamReader.<init>(InputStreamReader.java:129)
ffs | at scala.io.BufferedSource.reader(BufferedSource.scala:24)
ffs | at scala.io.BufferedSource.bufferedReader(BufferedSource.scala:25)
ffs | at scala.io.BufferedSource.scala$io$BufferedSource$$charReader$lzycompute(BufferedSource.scala:35)
ffs | at scala.io.BufferedSource.scala$io$BufferedSource$$charReader(BufferedSource.scala:33)
ffs | at scala.io.BufferedSource.scala$io$BufferedSource$$decachedReader(BufferedSource.scala:62)
ffs | at scala.io.BufferedSource.mkString(BufferedSource.scala:91)
ffs | at play.modules.swagger.SwaggerPluginImpl.play$modules$swagger$SwaggerPluginImpl$$parseRoutesHelper$1(SwaggerPlugin.scala:123)
ffs | at play.modules.swagger.SwaggerPluginImpl$$anonfun$1.applyOrElse(SwaggerPlugin.scala:134)
EDIT - I think my issue is related to the sird router, see https://github.com/swagger-api/swagger-play/issues/152#issuecomment-354515507
Hi,
I still don't understand if it's possible to add Swagger to play2.5. According to the instructions on the main page, I still get the exceptions described in previous issues. I know that there are a lot of discussions about it on the other issues, but I still don't understand the final answer - does it work or not.
Thanks,