Spring Fox with @FeignClient error
See original GitHub issueI am upgrading my application from Spring Boot 1.2 to 1.3. This produces error when I am starting the application, probably on initializing @FeignClient
beans:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myFeignClient': FactoryBean threw exception on object creation; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1585) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
... 37 common frames omitted
Caused by: java.lang.NullPointerException: null
at springfox.documentation.schema.property.OptimizedModelPropertiesProvider.beanDescription(OptimizedModelPropertiesProvider.java:317) ~[springfox-schema-2.2.2.jar:2.2.2]
at springfox.documentation.schema.property.OptimizedModelPropertiesProvider.propertiesFor(OptimizedModelPropertiesProvider.java:117) ~[springfox-schema-2.2.2.jar:2.2.2]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at springfox.documentation.spring.web.caching.CachingAspect.cachedValue(CachingAspect.java:86) ~[springfox-spring-web-2.2.2.jar:2.2.2]
at springfox.documentation.spring.web.caching.CachingAspect.operationsAndProperties(CachingAspect.java:69) ~[springfox-spring-web-2.2.2.jar:2.2.2]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at com.sun.proxy.$Proxy167.propertiesFor(Unknown Source) ~[na:na]
at springfox.documentation.schema.ModelDependencyProvider.propertiesFor(ModelDependencyProvider.java:184) ~[springfox-schema-2.2.2.jar:2.2.2]
at springfox.documentation.schema.ModelDependencyProvider.nonTrivialProperties(ModelDependencyProvider.java:132) ~[springfox-schema-2.2.2.jar:2.2.2]
at springfox.documentation.schema.ModelDependencyProvider.resolvedPropertiesAndFields(ModelDependencyProvider.java:121) ~[springfox-schema-2.2.2.jar:2.2.2]
at springfox.documentation.schema.ModelDependencyProvider.resolvedDependencies(ModelDependencyProvider.java:100) ~[springfox-schema-2.2.2.jar:2.2.2]
at springfox.documentation.schema.ModelDependencyProvider.resolvedTypeParameters(ModelDependencyProvider.java:110) ~[springfox-schema-2.2.2.jar:2.2.2]
at springfox.documentation.schema.ModelDependencyProvider.resolvedDependencies(ModelDependencyProvider.java:99) ~[springfox-schema-2.2.2.jar:2.2.2]
at springfox.documentation.schema.ModelDependencyProvider.dependentModels(ModelDependencyProvider.java:62) ~[springfox-schema-2.2.2.jar:2.2.2]
at springfox.documentation.schema.ModelDependencyProvider$$FastClassBySpringCGLIB$$ac0d0878.invoke(<generated>) ~[springfox-schema-2.2.2.jar:2.2.2]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:718) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at springfox.documentation.spring.web.caching.CachingAspect.cachedValue(CachingAspect.java:86) ~[springfox-spring-web-2.2.2.jar:2.2.2]
at springfox.documentation.spring.web.caching.CachingAspect.modelsAndDependencies(CachingAspect.java:80) ~[springfox-spring-web-2.2.2.jar:2.2.2]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:654) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at springfox.documentation.schema.ModelDependencyProvider$$EnhancerBySpringCGLIB$$b45db8c4.dependentModels(<generated>) ~[springfox-schema-2.2.2.jar:2.2.2]
at springfox.documentation.schema.DefaultModelProvider.dependencies(DefaultModelProvider.java:113) ~[springfox-schema-2.2.2.jar:2.2.2]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at com.sun.proxy.$Proxy168.dependencies(Unknown Source) ~[na:na]
at springfox.documentation.spring.web.scanners.ApiModelReader.populateDependencies(ApiModelReader.java:131) ~[springfox-spring-web-2.2.2.jar:2.2.2]
at springfox.documentation.spring.web.scanners.ApiModelReader.read(ApiModelReader.java:75) ~[springfox-spring-web-2.2.2.jar:2.2.2]
at springfox.documentation.spring.web.scanners.ApiListingScanner.scan(ApiListingScanner.java:91) ~[springfox-spring-web-2.2.2.jar:2.2.2]
at springfox.documentation.spring.web.scanners.ApiDocumentationScanner.scan(ApiDocumentationScanner.java:62) ~[springfox-spring-web-2.2.2.jar:2.2.2]
at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.scanDocumentation(DocumentationPluginsBootstrapper.java:101) ~[springfox-spring-web-2.2.2.jar:2.2.2]
at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.onApplicationEvent(DocumentationPluginsBootstrapper.java:87) ~[springfox-spring-web-2.2.2.jar:2.2.2]
at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.onApplicationEvent(DocumentationPluginsBootstrapper.java:50) ~[springfox-spring-web-2.2.2.jar:2.2.2]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:380) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:386) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:854) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:540) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.cloud.netflix.feign.FeignClientFactory.createContext(FeignClientFactory.java:108) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
at org.springframework.cloud.netflix.feign.FeignClientFactory.getContext(FeignClientFactory.java:75) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
at org.springframework.cloud.netflix.feign.FeignClientFactory.getInstance(FeignClientFactory.java:113) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.getOptional(FeignClientFactoryBean.java:120) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.feign(FeignClientFactoryBean.java:71) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:143) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
... 45 common frames omitted
Some fragments of my pom.xml:
...
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.RELEASE</version>
<relativePath/>
</parent>
....
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>Brixton.M3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Also I have @EnableFeignClients
annotation on my main class and when I remove this one, the error seems to be gone and application is starting properly.
What can be the problem?
Issue Analytics
- State:
- Created 8 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
FeignClient is not working with @Autowired in spring boot
I have a feign client: @FeignClient(name="admit-card-service") public interface CallFeignClient { @GetMapping("centers") public ...
Read more >Feign Client Exception Handling - Baeldung
We'll demonstrate how to handle exceptions in Feign in a Spring ... When an error occurs, the Feign client suppresses the original message....
Read more >Generating Feign clients with Swagger Codegen and Gradle
Spring Cloud has a Feign integration which means that you can have Spring MVC annotations to define the API, like @RequestMapping , @ ......
Read more >Error with FF4J configuration in spring boot project-Springboot
I can confirm that current version of ff4j is using the Swagger 3.0.0 which seems not backward compatible with 2.4.0. Multiple options:.
Read more >Microservices With Spring Cloud Kubernetes - Piotr's TechBlog
Now, we can implement the Feign client interface responsible for consuming the target endpoint. Here's a sample client from department-service ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
With the
@RequestBody
error in another issue, is there anything left to do in this one?Nothing left here, we can close the issue I believe. Thanks all for helping 😃