Search code examples
javajacksonswaggerglassfish-4nosuchmethoderror

Exclude methods of jax-rs service from swagger.json


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?


Solution

  • It's related with Glassfish, it use different version of Jackson. You need to upgrade Glassfish/Jackson. More details: