Open frantuma opened 7 years ago
@Tvaroh please try with latest 1.6.1-SNAPSHOT
version which has some updated deps, possibly it could solve your issue
@frantuma sure, just tried and got similar stack trace:
1) Error injecting constructor, scala.MatchError: @javax.inject.Inject() (of class com.sun.proxy.$Proxy6)
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 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)
at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1.reload(DevServerStart.scala:171)
... 25 common frames omitted
Caused by: scala.MatchError: @javax.inject.Inject() (of class com.sun.proxy.$Proxy6)
at com.fasterxml.jackson.module.scala.introspect.ScalaAnnotationIntrospector$$anonfun$1.apply(ScalaAnnotationIntrospectorModule.scala:85)
at com.fasterxml.jackson.module.scala.introspect.ScalaAnnotationIntrospector$$anonfun$1.apply(ScalaAnnotationIntrospectorModule.scala:85)
at scala.PartialFunction$$anonfun$apply$1.applyOrElse(PartialFunction.scala:247)
at scala.PartialFunction$$anonfun$runWith$1.apply(PartialFunction.scala:141)
at scala.PartialFunction$$anonfun$runWith$1.apply(PartialFunction.scala:140)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
at scala.collection.TraversableLike$class.collect(TraversableLike.scala:271)
at scala.collection.mutable.ArrayOps$ofRef.collect(ArrayOps.scala:186)
at com.fasterxml.jackson.module.scala.introspect.ScalaAnnotationIntrospector$$anonfun$4.apply(ScalaAnnotationIntrospectorModule.scala:98)
at com.fasterxml.jackson.module.scala.introspect.ScalaAnnotationIntrospector$$anonfun$4.apply(ScalaAnnotationIntrospectorModule.scala:97)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
at scala.collection.mutable.ArrayOps$ofRef.flatMap(ArrayOps.scala:186)
at com.fasterxml.jackson.module.scala.introspect.ScalaAnnotationIntrospector$.hasCreatorAnnotation(ScalaAnnotationIntrospectorModule.scala:97)
at com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair.hasCreatorAnnotation(AnnotationIntrospectorPair.java:709)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector._addCreatorParam(POJOPropertiesCollector.java:486)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector._addCreators(POJOPropertiesCollector.java:451)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.collectAll(POJOPropertiesCollector.java:307)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.getPropertyMap(POJOPropertiesCollector.java:267)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.getProperties(POJOPropertiesCollector.java:159)
at com.fasterxml.jackson.databind.introspect.BasicBeanDescription._properties(BasicBeanDescription.java:144)
at com.fasterxml.jackson.databind.introspect.BasicBeanDescription.findProperties(BasicBeanDescription.java:219)
at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:320)
at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:185)
at io.swagger.scala.converter.SwaggerScalaModelConverter.resolve(SwaggerScalaModelConverter.scala:86)
at io.swagger.converter.ModelConverterContextImpl.resolve(ModelConverterContextImpl.java:100)
at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:236)
at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:185)
at io.swagger.scala.converter.SwaggerScalaModelConverter.resolve(SwaggerScalaModelConverter.scala:86)
at io.swagger.converter.ModelConverterContextImpl.resolve(ModelConverterContextImpl.java:100)
at io.swagger.jackson.ModelResolver.resolveProperty(ModelResolver.java:161)
at io.swagger.jackson.ModelResolver.resolveProperty(ModelResolver.java:112)
at io.swagger.scala.converter.SwaggerScalaModelConverter.resolveProperty(SwaggerScalaModelConverter.scala:70)
at io.swagger.converter.ModelConverterContextImpl.resolveProperty(ModelConverterContextImpl.java:80)
at io.swagger.converter.ModelConverters.readAsProperty(ModelConverters.java:58)
at play.modules.swagger.PlayReader.parseMethod(PlayReader.java:487)
at play.modules.swagger.PlayReader.read(PlayReader.java:139)
at play.modules.swagger.PlayReader.read(PlayReader.java:63)
at play.modules.swagger.PlayReader.read(PlayReader.java:57)
at play.modules.swagger.ApiListingCache$$anonfun$listing$1.apply(ApiListingCache.scala:17)
at play.modules.swagger.ApiListingCache$$anonfun$listing$1.apply(ApiListingCache.scala:11)
at scala.Option.orElse(Option.scala:289)
at play.modules.swagger.ApiListingCache$.listing(ApiListingCache.scala:11)
at play.modules.swagger.SwaggerPluginImpl.<init>(SwaggerPlugin.scala:164)
at play.modules.swagger.SwaggerPluginImpl$$FastClassByGuice$$de7219b8.newInstance(<generated>)
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.FactoryProxy.get(FactoryProxy.java:56)
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.InternalInjectorCreator$1.call(InternalInjectorCreator.java:205)
at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:199)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1085)
at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180)
... 35 common frames omitted
I am getting this also. Any work around? or anyone know what issue is? Happy to help with fix and contribute if someone familiar with codebase can point me to the right place to save time. Thanks
@softinio It's a bug in jackson on this line:
val jsonCreators = PartialFunction[Annotation, JsonCreator]({ case jc: JsonCreator => jc })
should be
val jsonCreators: PartialFunction[Annotation, JsonCreator] = { case jc: JsonCreator => jc }
I suggest making a PR there. They might want a test case for it
@dwickern I will do that ... in the meanwhile is there a workaround?
Is there a work around for this. I'm currently facing this issue and it has become a blocker.
@icemc I never managed to find a workaround and in the end just created a swagger.json manually.
I never gave it a try but there is this:
Hello @softinio after digging my head into this for several days I managed to solve the issue on my end. It was related to my java version. I was using java 9 and when I uninstalled it and installed the latest java 8 everything was good to go.
I get the following error:
[...]
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Scala module 2.8.9 requires Jackson Databind version >= 2.8.0 and < 2.9.0
at com.fasterxml.jackson.module.scala.JacksonModule.setupModule(JacksonModule.scala:66)
at com.fasterxml.jackson.module.scala.JacksonModule.setupModule$(JacksonModule.scala:51)
at com.fasterxml.jackson.module.scala.DefaultScalaModule.setupModule(DefaultScalaModule.scala:18)
at com.fasterxml.jackson.databind.ObjectMapper.registerModule(ObjectMapper.java:751)
at io.swagger.scala.converter.SwaggerScalaModelConverter$.<init>(SwaggerScalaModelConverter.scala:15)
at io.swagger.scala.converter.SwaggerScalaModelConverter$.<clinit>(SwaggerScalaModelConverter.scala)
at io.swagger.scala.converter.SwaggerScalaModelConverter.<init>(SwaggerScalaModelConverter.scala:19)
[...]
I feel this is the same error.
I found a workaround that seems to be working fine (from https://stackoverflow.com/a/43845063). Add the following to your build.sbt
:
dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.9"
Maybe it could be fixed by adding jackson databind 2.8.9 to the dependencies in play-2.6/swagger-play2/build.sbt
?
Still seeing this issue, in my case when running test cases
Possible solution - https://stackoverflow.com/a/43574427 For me it was just adding the jaxb-api as a dependency when moving away from Java 8
Another solution if you run into this trying to run tests on your app: https://stackoverflow.com/a/59904422/2340227
refs #143
moving here specific issue, while closing #143 as 1.6.0 is out.
@Tvaroh
I'm getting
using the snapshot and Play 2.6.
Any suggestions?
@dwickern
@Tvaroh is there more to that stack trace? Are you doing anything unusual, like using a different DI container, other Play plugins which might conflict, etc?
@Tvaroh
@dwickern I don't think there is anything unusual, just a bare Play app with awful Guice for DI and no other plugins from what I can see. Full stack trace is: