Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dataType class loading issue in managed containers such as play framework #1635

Merged
merged 1 commit into from
Feb 9, 2016

Conversation

yaronyam
Copy link
Contributor

When setting dataType on ApiModelProperty annotation, where the type is referenced from an ApiImplicitParam annotation - I get the below exception, running from Play Framework 2.4.6.
This issue may be relevant to other frameworks. This is due to the framework's customized class loading mechanism. In play - the project sources are loaded in a child class loader of the loaded dependencies, this cater for hot swapping during development. As a side effect, a class imported as a dependency can't load a local project class from it's current class loader or one of it's parent class loaders.
Sorry for the lack of UT coverage, it was difficult for me to simulate such a scenario.

Caused by: java.lang.IllegalArgumentException: Unrecognized Type: [null]
    at com.fasterxml.jackson.databind.type.TypeFactory._constructType(TypeFactory.java:405) ~[jackson-databind.jar:2.5.4]
    at com.fasterxml.jackson.databind.type.TypeFactory.constructType(TypeFactory.java:354) ~[jackson-databind.jar:2.5.4]
    at com.fasterxml.jackson.databind.ObjectMapper.constructType(ObjectMapper.java:1332) ~[jackson-databind.jar:2.5.4]
    at io.swagger.scala.converter.SwaggerScalaModelConverter.resolveProperty(SwaggerScalaModelConverter.scala:34) ~[na:na]
    at io.swagger.converter.ModelConverterContextImpl.resolveProperty(ModelConverterContextImpl.java:79) ~[swagger-core-1.5.4.jar:1.5.4]
    at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:355) ~[swagger-core-1.5.4.jar:1.5.4]
    at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:159) ~[swagger-core-1.5.4.jar:1.5.4]
    at io.swagger.scala.converter.SwaggerScalaModelConverter.resolve(SwaggerScalaModelConverter.scala:101) ~[na:na]
    at io.swagger.converter.ModelConverterContextImpl.resolve(ModelConverterContextImpl.java:99) ~[swagger-core-1.5.4.jar:1.5.4]
    at io.swagger.jackson.ModelResolver.resolveProperty(ModelResolver.java:138) ~[swagger-core-1.5.4.jar:1.5.4]
    at io.swagger.jackson.ModelResolver.resolveProperty(ModelResolver.java:103) ~[swagger-core-1.5.4.jar:1.5.4]
    at io.swagger.scala.converter.SwaggerScalaModelConverter.resolveProperty(SwaggerScalaModelConverter.scala:69) ~[na:na]
    at io.swagger.converter.ModelConverterContextImpl.resolveProperty(ModelConverterContextImpl.java:79) ~[swagger-core-1.5.4.jar:1.5.4]
    at io.swagger.converter.ModelConverters.readAsProperty(ModelConverters.java:58) ~[swagger-core-1.5.4.jar:1.5.4]
    at io.swagger.util.ParameterProcessor.applyAnnotations(ParameterProcessor.java:155) ~[swagger-core-1.5.4.jar:1.5.4]
    at play.modules.swagger.PlayReader.readImplicitParam(PlayReader.java:386) ~[swagger-play2_2.11-1.5.0.jar:1.5.0]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants