title: Swagger reader throws java.lang.NoSuchMethodError
body: <p>I am trying to create API documentation in my project(Sparkjava). [I use this article][1] I wrote this parser:</p>
  <pre><code>import com.fasterxml.jackson.annotation.JsonInclude.Include;
  import com.fasterxml.jackson.core.JsonProcessingException;
  import com.fasterxml.jackson.databind.ObjectMapper;
  import io.swagger.jaxrs.Reader;
  import io.swagger.models.*;
  import spark.Route;
  
  import java.util.Arrays;
  import java.util.List;
  
  public class SwaggerParser {
  
      public static String getSwaggerJson(List&lt;Route&gt; routes) throws JsonProcessingException {
          Swagger swagger = getSwagger(routes);
          return swaggerToJson(swagger);
      }
  
      private static Swagger getSwagger(List&lt;Route&gt; routes) {
          Swagger swagger = new Swagger();
          swagger.info(new Info().description(&quot;User API&quot;)
                  .version(&quot;V1.0&quot;)
                  .title(&quot;Some random api for testing&quot;)
                  .contact(new Contact().name(&quot;Serol&quot;).url(&quot;https://serol.ro&quot;)));
          swagger.schemes(Arrays.asList(Scheme.HTTP, Scheme.HTTPS));
          swagger.consumes(&quot;application/json&quot;);
          swagger.produces(&quot;application/json&quot;);
          swagger.tag(new Tag().name(&quot;swagger&quot;));
  
          Reader reader = new Reader(swagger);
  
          for (Route route : routes) {
              try {
                  reader.read(route.getClass());
              }catch (Throwable throwable){
                  System.out.println(throwable);
              }
          }
  
          return reader.getSwagger();
      }
  
      public static String swaggerToJson(Swagger swagger) throws JsonProcessingException {
          ObjectMapper objectMapper = new ObjectMapper();
          objectMapper.setSerializationInclusion(Include.NON_EMPTY);
          return objectMapper.writeValueAsString(swagger);
      }
  
  }
  </code></pre>
  <p>It works in my test application but doesn't work in the real project. I wrote init test for that:</p>
  <pre><code>import com.fasterxml.jackson.core.JsonProcessingException;
  import com.healthgorilla.portal.server.labnetwork.api.GetOrdersAPI;
  import com.healthgorilla.portal.server.labnetwork.route.GetOrdersRoute;
  import org.junit.Test;
  
  import java.util.Collections;
  
  import static org.junit.Assert.*;
  import static org.mockito.Mockito.mock;
  import static org.mockito.Mockito.when;
  
  public class SwaggerParserTest {
      @Test
      public void name() throws JsonProcessingException {
          GetOrdersAPI api = mock(GetOrdersAPI.class);
          when(api.exec()).thenReturn(&quot;&quot;);
  
          String swaggerJson = SwaggerParser.getSwaggerJson(Collections.singletonList(new GetOrdersRoute(api)));
          
          assertNotNull(swaggerJson);
      }
  }
  </code></pre>
  <p>And it throws an exception:</p>
  <pre><code>java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.introspect.AnnotatedMember.getType(Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
  </code></pre>
  <p>But in the test project it works
  [1]: <a href="https://serol.ro/posts/2016/swagger_sparkjava/" rel="nofollow noreferrer">https://serol.ro/posts/2016/swagger_sparkjava/</a></p>
  <p>EDIT:</p>
  <p>I found conflict. It newer jckson version in the project. I change my swagger dependencies</p>
  <pre><code>&lt;!-- swagger --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.swagger&lt;/groupId&gt;
              &lt;artifactId&gt;swagger-core&lt;/artifactId&gt;
              &lt;version&gt;1.6.2&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
                      &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
                      &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
                      &lt;artifactId&gt;jackson-annotations&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.swagger&lt;/groupId&gt;
              &lt;artifactId&gt;swagger-jaxrs&lt;/artifactId&gt;
              &lt;version&gt;1.6.2&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
                      &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
                      &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
                      &lt;artifactId&gt;jackson-annotations&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
  </code></pre>
  <p>But it doesn't help. There are my Jackson dependencies:</p>
  <pre><code>&lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
              &lt;version&gt;2.11.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
              &lt;version&gt;2.11.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-annotations&lt;/artifactId&gt;
              &lt;version&gt;2.11.2&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>