我在我的java EE7应用程序上使用swagger(Glassfish作为应用程序服务器)。一切正常,除了FormDataParam的方法,它给了我一个传统的错误:
org.glassfish.jersey.server.ContainerException: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyIndex(Lcom/fasterxml/jackson/databind/introspect/Annotated;)Ljava/lang/Integer;
我尝试了所有方法,但这只是一种方法,所以我不希望这种方法在我的swagger.json中非常糟糕
如何从swagger中排除此方法。我试过了:
@ApiModelProperty(hidden = true) and @ApiOperation(value="",hidden = true)
@POST
@Path("something")
@Produces(MediaType.TEXT_PLAIN)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response newsomething(@FormParam("something") String something,@Context HttpServletRequest request, @Context HttpServletResponse response) throws IOException {
return "something";
}
我做错了什么?
答案 0 :(得分:3)
它与Glassfish有关,它使用不同版本的Jackson。你需要升级Glassfish / Jackson。更多细节:
java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyIndex(Lcom/fasterxml/jackson/databind/introspect/Annotated;)Ljava/lang/Integer
解决方案https://github.com/swagger-api/swagger-core/issues/1001 java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyIndex(Lcom/fasterxml/jackson/databind/introspect/Annotated;)Ljava/lang/Integer;
解决方案 - https://groups.google.com/forum/#!topic/swagger-swaggersocket/uQEn-anX_Og java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyDesc
解决方案https://groups.google.com/forum/#!topic/swagger-swaggersocket/x-Pz_3orTCE