I´m using swagger on my java EE7 application (Glassfish as application server). Everything works fine except for a method with FormDataParam, which gave me the tradicional error:
org.glassfish.jersey.server.ContainerException: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyIndex(Lcom/fasterxml/jackson/databind/introspect/Annotated;)Ljava/lang/Integer;
I tried everything, but is just a method, so I do not want so badly this method in my swagger.json
How can I exclude this method from swagger. I tried:
@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";
}
What I´m doing wrong?
It's related with Glassfish, it use different version of Jackson. You need to upgrade Glassfish/Jackson. More details:
java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyIndex(Lcom/fasterxml/jackson/databind/introspect/Annotated;)Ljava/lang/Integer
solution 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;
solution - https://groups.google.com/forum/#!topic/swagger-swaggersocket/uQEn-anX_Og java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyDesc
solution https://groups.google.com/forum/#!topic/swagger-swaggersocket/x-Pz_3orTCE For me adding @ApiModelProperty(hidden = true) in paths worked Is it wrong or correct?
@ApiModelProperty(hidden = true)
@GET
@Produces({MediaType.APPLICATION_JSON})
@ApiOperation(value = "return getApi ",
tags = {"getApi"},
notes = "Returns a Array of getApi",
hidden = true
)
@ApiResponses(value = {
@ApiResponse(response = GetApi.class, message = "", code = 200)
})
@Path("getApi")
public Response getApi(@Context HttpHeaders httpHeaders, @BeanParam QueryParamBean queryParamBean) {
// codes..
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.