Skip to content

Getting Below Jackson exception while building the project

Getting Below build exception while migrating the Springboot project from spring 1.1.1 release to 2.3.12 release . Please help here.

Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.introspect.AnnotatedMember.getType(Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
    at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:377)
    at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:183)
    at io.swagger.converter.ModelConverterContextImpl.resolve(ModelConverterContextImpl.java:100)
    at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:234)
    at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:183)
    at io.swagger.converter.ModelConverterContextImpl.resolve(ModelConverterContextImpl.java:100)
    at io.swagger.jackson.ModelResolver.resolveProperty(ModelResolver.java:159)
    at io.swagger.jackson.ModelResolver.resolveProperty(ModelResolver.java:110)
    at io.swagger.converter.ModelConverterContextImpl.resolveProperty(ModelConverterContextImpl.java:80)
    at io.swagger.converter.ModelConverters.readAsProperty(ModelConverters.java:58)
    at io.swagger.jaxrs.Reader.addResponse(Reader.java:1018)
    at io.swagger.jaxrs.Reader.parseMethod(Reader.java:940)
    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)
    at io.swagger.jaxrs.config.BeanConfig.setScan(BeanConfig.java:221)
    at org.apache.cxf.jaxrs.swagger.Swagger2Feature.initBeanConfig(Swagger2Feature.java:354)
    at org.apache.cxf.jaxrs.swagger.Swagger2Feature.addSwaggerResource(Swagger2Feature.java:201)
    at org.apache.cxf.jaxrs.swagger.AbstractSwaggerFeature.initialize(AbstractSwaggerFeature.java:68)
    at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.applyFeatures(JAXRSServerFactoryBean.java:252)
    at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:196)
    at com.daimler.icon2.contractcreation.general.service.config.ServiceConfig.jaxRsServer(ServiceConfig.java:138)
    at com.daimler.icon2.contractcreation.general.service.config.ServiceConfig$$EnhancerBySpringCGLIB$$62437023.CGLIB$jaxRsServer$3(<generated>)
    at com.daimler.icon2.contractcreation.general.service.config.ServiceConfig$$EnhancerBySpringCGLIB$$62437023$$FastClassBySpringCGLIB$$46d5367f.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
    at com.daimler.icon2.contractcreation.general.service.config.ServiceConfig$$EnhancerBySpringCGLIB$$62437023.jaxRsServer(<generated>)
    at sun.reflect.GeneratedMethodAccessor334.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    ... 68 common frames omitted

Answer

This issue seems to be related to a version mismatch. This method was removed some time ago.

There is a closed issue for this on swagger plug-in https://github.com/swagger-api/swagger-core/issues/3554

Migrating this difference in versions, I think spring is now shipped with newer Jackson libraries in which this method is removed.

Try upgrading you swagger plug-in version.