Hi,

We are trying to implement Jersey2 on SpringBoot2.0.0.M3 and Swagger. 

Jersey2 and SpringBoot2.0.0.M3 application works as expected, but when we 
introduce Swagger into the mix we encounter jackson dependency issues.

io.swagger:swagger-jersey2-jaxrs 1.5.16 has transative dependencies on 
jackson 2.9.0.pr4 in which the method AnnotatedMember.annotations() is 
missing. This method is available in older versions of jackson e.g. 2.7.0 
but this version is not compatible with Spring 5.

Please see default dependency tree below:

[INFO] +- 
org.springframework.boot:spring-boot-starter-actuator:jar:2.0.0.M3:compile
[INFO] |  +- 
org.springframework.boot:spring-boot-starter:jar:2.0.0.M3:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:2.0.0.M3:compile
[INFO] |  |  +- 
org.springframework.boot:spring-boot-autoconfigure:jar:2.0.0.M3:compile
[INFO] |  |  \- 
org.springframework.boot:spring-boot-starter-logging:jar:2.0.0.M3:compile
[INFO] |  |     +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] |  |     |  \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] |  |     +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] |  |     \- org.slf4j:log4j-over-slf4j:jar:1.7.25:compile
[INFO] |  \- 
org.springframework.boot:spring-boot-actuator:jar:2.0.0.M3:compile
[INFO] |     \- org.springframework:spring-context:jar:5.0.0.RC3:compile
[INFO] +- 
org.springframework.boot:spring-boot-actuator-docs:jar:2.0.0.M3:compile
[INFO] |  +- 
org.springframework.hateoas:spring-hateoas:jar:0.23.0.RELEASE:compile
[INFO] |  \- org.springframework:spring-core:jar:5.0.0.RC3:compile
[INFO] |     \- org.springframework:spring-jcl:jar:5.0.0.RC3:compile
[INFO] +- 
org.springframework.boot:spring-boot-starter-jersey:jar:2.0.0.M3:compile
[INFO] |  +- org.springframework:spring-web:jar:5.0.0.RC3:compile
[INFO] |  +- org.glassfish.jersey.core:jersey-server:jar:2.25.1:compile
[INFO] |  |  +- org.glassfish.jersey.core:jersey-common:jar:2.25.1:compile
[INFO] |  |  |  +- 
org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.25.1:compile
[INFO] |  |  |  \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[INFO] |  |  +- org.glassfish.jersey.core:jersey-client:jar:2.25.1:compile
[INFO] |  |  +- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
[INFO] |  |  +- 
org.glassfish.jersey.media:jersey-media-jaxb:jar:2.25.1:compile
[INFO] |  |  +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] |  |  +- org.glassfish.hk2:hk2-api:jar:2.5.0-b32:compile
[INFO] |  |  |  +- org.glassfish.hk2:hk2-utils:jar:2.5.0-b32:compile
[INFO] |  |  |  \- 
org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b32:compile
[INFO] |  |  +- 
org.glassfish.hk2.external:javax.inject:jar:2.5.0-b32:compile
[INFO] |  |  \- org.glassfish.hk2:hk2-locator:jar:2.5.0-b32:compile
[INFO] |  +- 
org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.25.1:compile
[INFO] |  +- 
org.glassfish.jersey.containers:jersey-container-servlet:jar:2.25.1:compile
[INFO] |  +- 
org.glassfish.jersey.ext:jersey-bean-validation:jar:2.25.1:compile
[INFO] |  \- org.glassfish.jersey.ext:jersey-spring3:jar:2.25.1:compile
[INFO] |     +- org.glassfish.hk2:hk2:jar:2.5.0-b32:compile
[INFO] |     |  +- org.glassfish.hk2:config-types:jar:2.5.0-b32:compile
[INFO] |     |  +- org.glassfish.hk2:hk2-core:jar:2.5.0-b32:compile
[INFO] |     |  +- org.glassfish.hk2:hk2-config:jar:2.5.0-b32:compile
[INFO] |     |  +- org.glassfish.hk2:hk2-runlevel:jar:2.5.0-b32:compile
[INFO] |     |  \- org.glassfish.hk2:class-model:jar:2.5.0-b32:compile
[INFO] |     |     \- 
org.glassfish.hk2.external:asm-all-repackaged:jar:2.5.0-b32:compile
[INFO] |     \- org.glassfish.hk2:spring-bridge:jar:2.5.0-b32:compile
[INFO] +- 
org.springframework.boot:spring-boot-starter-tomcat:jar:2.0.0.M3:provided
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.16:provided
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.16:compile
[INFO] |  \- 
org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.16:provided
[INFO] +- 
org.springframework.boot:spring-boot-starter-data-jpa:jar:2.0.0.M3:compile
[INFO] |  +- 
org.springframework.boot:spring-boot-starter-aop:jar:2.0.0.M3:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.8.10:compile
[INFO] |  +- 
org.springframework.boot:spring-boot-starter-jdbc:jar:2.0.0.M3:compile
[INFO] |  |  +- com.zaxxer:HikariCP:jar:2.6.3:compile
[INFO] |  |  \- org.springframework:spring-jdbc:jar:5.0.0.RC3:compile
[INFO] |  +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:2.0.0.RC2:compile
[INFO] |  |  +- 
org.springframework.data:spring-data-commons:jar:2.0.0.RC2:compile
[INFO] |  |  \- org.springframework:spring-orm:jar:5.0.0.RC3:compile
[INFO] |  \- org.springframework:spring-aspects:jar:5.0.0.RC3:compile
[INFO] +- org.springframework:spring-tx:jar:5.0.0.RC3:compile
[INFO] |  \- org.springframework:spring-beans:jar:5.0.0.RC3:compile
[INFO] +- 
org.springframework.boot:spring-boot-starter-jta-atomikos:jar:2.0.0.M3:compile
[INFO] |  +- com.atomikos:transactions-jms:jar:4.0.4:compile
[INFO] |  +- com.atomikos:transactions-jta:jar:4.0.4:compile
[INFO] |  |  +- com.atomikos:transactions-api:jar:4.0.4:compile
[INFO] |  |  +- com.atomikos:transactions:jar:4.0.4:runtime
[INFO] |  |  \- com.atomikos:atomikos-util:jar:4.0.4:compile
[INFO] |  \- com.atomikos:transactions-jdbc:jar:4.0.4:compile
[INFO] +- org.liquibase:liquibase-core:jar:3.5.3:compile
[INFO] |  \- org.yaml:snakeyaml:jar:1.18:compile
[INFO] +- org.hibernate:hibernate-core:jar:5.2.10.Final:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile
[INFO] |  +- org.javassist:javassist:jar:3.21.0-GA:compile
[INFO] |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  +- 
org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.1.Final:compile
[INFO] |  +- org.jboss:jandex:jar:2.0.3.Final:compile
[INFO] |  +- com.fasterxml:classmate:jar:1.3.3:compile
[INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  \- 
org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:5.2.10.Final:compile
[INFO] |  \- net.bytebuddy:byte-buddy:jar:1.6.14:compile
[INFO] +- 
org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] +- org.liquibase.ext:liquibase-hibernate5:jar:3.6:compile
[INFO] |  \- org.hibernate:hibernate-envers:jar:5.2.10.Final:compile
[INFO] +- org.springframework.retry:spring-retry:jar:1.2.1.RELEASE:compile
[INFO] +- 
org.springframework.boot:spring-boot-starter-security:jar:2.0.0.M3:compile
[INFO] |  +- org.springframework:spring-aop:jar:5.0.0.RC3:compile
[INFO] |  +- 
org.springframework.security:spring-security-config:jar:5.0.0.M3:compile
[INFO] |  \- 
org.springframework.security:spring-security-web:jar:5.0.0.M3:compile
[INFO] |     \- org.springframework:spring-expression:jar:5.0.0.RC3:compile
[INFO] +- 
org.springframework.boot:spring-boot-starter-validation:jar:2.0.0.M3:compile
[INFO] |  \- org.hibernate:hibernate-validator:jar:5.4.1.Final:compile
[INFO] +- com.h2database:h2:jar:1.4.196:runtime
[INFO] +- 
org.springframework.boot:spring-boot-starter-test:jar:2.0.0.M3:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.0.0.M3:test
[INFO] |  +- 
org.springframework.boot:spring-boot-test-autoconfigure:jar:2.0.0.M3:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] |  |  \- net.minidev:json-smart:jar:2.3:test
[INFO] |  |     \- net.minidev:accessors-smart:jar:1.2:test
[INFO] |  |        \- org.ow2.asm:asm:jar:5.0.4:test
[INFO] |  +- junit:junit:jar:4.12:test
[INFO] |  +- org.assertj:assertj-core:jar:3.8.0:test
[INFO] |  +- org.mockito:mockito-core:jar:2.8.47:test
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.6.14:test
[INFO] |  |  \- org.objenesis:objenesis:jar:2.5:test
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] |  |  \- 
com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] |  \- org.springframework:spring-test:jar:5.0.0.RC3:test
[INFO] +- 
org.springframework.restdocs:spring-restdocs-mockmvc:jar:1.2.1.RELEASE:test
[INFO] |  +- javax.servlet:javax.servlet-api:jar:3.1.0:test
[INFO] |  +- 
org.springframework.restdocs:spring-restdocs-core:jar:1.2.1.RELEASE:test
[INFO] |  \- org.springframework:spring-webmvc:jar:5.0.0.RC3:compile
[INFO] +- 
org.springframework.security:spring-security-test:jar:5.0.0.M3:test
[INFO] |  \- 
org.springframework.security:spring-security-core:jar:5.0.0.M3:compile
[INFO] |     \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
[INFO] +- io.swagger:swagger-jersey2-jaxrs:jar:1.5.16:compile
[INFO] |  \- 
org.glassfish.jersey.media:jersey-media-multipart:jar:2.25.1:compile
[INFO] |     \- org.jvnet.mimepull:mimepull:jar:1.9.6:compile
[INFO] +- io.swagger:swagger-codegen:jar:2.2.3:compile
[INFO] |  +- io.swagger:swagger-parser:jar:1.0.32:compile
[INFO] |  +- io.swagger:swagger-compat-spec-parser:jar:1.0.32:compile
[INFO] |  |  +- 
com.github.java-json-tools:json-schema-validator:jar:2.2.8:compile
[INFO] |  |  |  +- 
com.github.java-json-tools:json-schema-core:jar:1.2.8:compile
[INFO] |  |  |  |  +- org.mozilla:rhino:jar:1.7R4:compile
[INFO] |  |  |  |  \- com.github.fge:uri-template:jar:0.9:compile
[INFO] |  |  |  +- javax.mail:mailapi:jar:1.4.3:compile
[INFO] |  |  |  |  \- javax.activation:activation:jar:1.1:compile
[INFO] |  |  |  +- joda-time:joda-time:jar:2.9.9:compile
[INFO] |  |  |  +- 
com.googlecode.libphonenumber:libphonenumber:jar:8.0.0:compile
[INFO] |  |  |  \- net.sf.jopt-simple:jopt-simple:jar:5.0.3:compile
[INFO] |  |  +- com.github.fge:json-patch:jar:1.6:compile
[INFO] |  |  |  \- com.github.fge:jackson-coreutils:jar:1.6:compile
[INFO] |  |  |     \- com.github.fge:msg-simple:jar:1.1:compile
[INFO] |  |  |        \- com.github.fge:btf:jar:1.2:compile
[INFO] |  |  \- org.apache.httpcomponents:httpclient:jar:4.5.3:compile
[INFO] |  |     +- org.apache.httpcomponents:httpcore:jar:4.4.6:compile
[INFO] |  |     \- commons-codec:commons-codec:jar:1.10:compile
[INFO] |  +- com.samskivert:jmustache:jar:1.13:compile
[INFO] |  +- commons-io:commons-io:jar:2.4:compile
[INFO] |  +- org.slf4j:slf4j-ext:jar:1.7.12:compile
[INFO] |  |  \- ch.qos.cal10n:cal10n-api:jar:0.8.1:compile
[INFO] |  +- org.slf4j:slf4j-simple:jar:1.7.25:compile
[INFO] |  +- org.apache.commons:commons-lang3:jar:3.6:compile
[INFO] |  +- commons-cli:commons-cli:jar:1.2:compile
[INFO] |  \- com.atlassian.commonmark:commonmark:jar:0.9.0:compile
[INFO] +- io.swagger:swagger-jaxrs:jar:1.5.16:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.0.pr4:compile
[INFO] +- 
com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0.pr4:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.9.0.pr4:compile
[INFO] +- io.swagger:swagger-core:jar:1.5.16:compile
[INFO] |  +- 
com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.9.0.pr4:compile
[INFO] |  +- io.swagger:swagger-models:jar:1.5.16:compile
[INFO] |  |  \- io.swagger:swagger-annotations:jar:1.5.16:compile
[INFO] |  \- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] +- org.reflections:reflections:jar:0.9.11:compile
[INFO] \- com.google.guava:guava:jar:23.0:compile
[INFO]    +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO]    +- 
com.google.errorprone:error_prone_annotations:jar:2.0.18:compile
[INFO]    +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO]    \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile

Stacktrace is below:


Caused by: java.lang.NoSuchMethodError: com.fasterxml.jac...
Caused by: java.lang.NoSuchMethodError: 
com.fasterxml.jackson.databind.introspect.AnnotatedMember.annotations()Ljava/lang/Iterable;
        at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:379)
        at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:185)
        at 
io.swagger.converter.ModelConverterContextImpl.resolve(ModelConverterContextImpl.java:100)
        at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:236)
        at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:185)
        at 
io.swagger.converter.ModelConverterContextImpl.resolve(ModelConverterContextImpl.java:100)
        at 
io.swagger.jackson.ModelResolver.resolveProperty(ModelResolver.java:161)
        at 
io.swagger.jackson.ModelResolver.resolveProperty(ModelResolver.java:112)
        at 
io.swagger.converter.ModelConverterContextImpl.resolveProperty(ModelConverterContextImpl.java:80)
        at 
io.swagger.converter.ModelConverters.readAsProperty(ModelConverters.java:58)
        at io.swagger.jaxrs.Reader.parseMethod(Reader.java:896)
        at io.swagger.jaxrs.Reader.read(Reader.java:322)
        at io.swagger.jaxrs.Reader.read(Reader.java:172)
        at 
io.swagger.jaxrs.config.BeanConfig.scanAndRead(BeanConfig.java:242)

Here is our Swagger configurartion:

package bff;

import javax.annotation.PostConstruct;

import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.server.wadl.internal.WadlResource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import bff.rest.BffRestController;

import io.swagger.jaxrs.config.BeanConfig;
import io.swagger.jaxrs.listing.ApiListingResource;
import io.swagger.jaxrs.listing.SwaggerSerializers;


@Component
public class JerseyConfig extends ResourceConfig {
@Value("${spring.jersey.application-path:/}")
private String apiPath;

    public JerseyConfig() {
        // Register endpoints, providers, ...
        this.registerEndpoints();
    }

    @PostConstruct
    public void init() {
        // Register components where DI is needed
        this.configureSwagger();
    }

    private void registerEndpoints() {
        this.register(BffRestController.class);
        // Access through /<Jersey's servlet path>/application.wadl
        this.register(WadlResource.class);
    }

    private void configureSwagger() {
        // Available at localhost:port/swagger.json
        this.register(ApiListingResource.class);
        this.register(SwaggerSerializers.class);

        BeanConfig config = new BeanConfig();
        config.setConfigId("springboot-jersey-swagger-bff");
        config.setTitle("Spring Boot + Jersey + Swagger + BFF");
        config.setVersion("v1");
        config.setContact("Markus Antonius");
        config.setSchemes(new String[] { "http", "https" });
        config.setBasePath(this.apiPath);
        config.setResourcePackage("bff.rest");
        config.setPrettyPrint(true);
        config.setScan(true);
    }
}

This is an urgent POC project, please advise us on how to proceed.

Best regards

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to