org.springframework.beans.factory.BeanCreationException

Error creating bean with name 'restTemplateBuilder' defined in class path resource [org/springframework/boot/autoconfigure/web/WebClientAutoConfiguration$RestTemplateConfiguration.class]: Post-processing failed of bean type [class org.springframework.boot.web.client.RestTemplateBuilder] failed; nested exception is java.lang.IllegalStateException: Failed to introspect bean class [org.springframework.boot.web.client.RestTemplateBuilder] for resource metadata: could not find class that it depends on

Samebug tips5

You might've forgot to add a dependency or it's written wrong. Also, you might be using incompatible versions of Java and Hibernate. More on this here: https://goo.gl/SjSlRA


rafaelrafael

Needs to add netty-transport-native-epoll with a OS classifier to the classpath, it's not included in netty-all

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web5085

Stack trace

  • org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'restTemplateBuilder' defined in class path resource [org/springframework/boot/autoconfigure/web/WebClientAutoConfiguration$RestTemplateConfiguration.class]: Post-processing failed of bean type [class org.springframework.boot.web.client.RestTemplateBuilder] failed; nested exception is java.lang.IllegalStateException: Failed to introspect bean class [org.springframework.boot.web.client.RestTemplateBuilder] for resource metadata: could not find class that it depends on at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:940)[spring-beans-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)[spring-beans-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)[spring-beans-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)[spring-beans-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)[spring-beans-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)[spring-beans-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)[spring-beans-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:775)[spring-beans-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)[spring-context-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)[spring-context-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)[spring-boot-1.4.0.BUILD-SNAPSHOT.jar:1.4.0.BUILD-SNAPSHOT] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)[spring-boot-1.4.0.BUILD-SNAPSHOT.jar:1.4.0.BUILD-SNAPSHOT] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369)[spring-boot-1.4.0.BUILD-SNAPSHOT.jar:1.4.0.BUILD-SNAPSHOT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)[spring-boot-1.4.0.BUILD-SNAPSHOT.jar:1.4.0.BUILD-SNAPSHOT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1176)[spring-boot-1.4.0.BUILD-SNAPSHOT.jar:1.4.0.BUILD-SNAPSHOT] at com.springboot.tutorial.App.main(App.java:23)[classes/:na] Caused by: java.lang.IllegalStateException: Failed to introspect bean class [org.springframework.boot.web.client.RestTemplateBuilder] for resource metadata: could not find class that it depends on at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.findResourceMetadata(CommonAnnotationBeanPostProcessor.java:344)[spring-context-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:297)[spring-context-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:935)[spring-beans-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] ... 15 more Caused by: java.lang.NoClassDefFoundError: Lorg/springframework/http/client/BasicAuthorizationInterceptor; at java.lang.Class.getDeclaredFields0(Native Method)[na:1.8.0_73] at java.lang.Class.privateGetDeclaredFields(Class.java:2583)[na:1.8.0_73] at java.lang.Class.getDeclaredFields(Class.java:1916)[na:1.8.0_73] at org.springframework.util.ReflectionUtils.getDeclaredFields(ReflectionUtils.java:713)[spring-core-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] at org.springframework.util.ReflectionUtils.doWithLocalFields(ReflectionUtils.java:655)[spring-core-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.buildResourceMetadata(CommonAnnotationBeanPostProcessor.java:361)[spring-context-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.findResourceMetadata(CommonAnnotationBeanPostProcessor.java:340)[spring-context-4.3.1.BUILD-SNAPSHOT.jar:4.3.1.BUILD-SNAPSHOT] ... 17 more Caused by: java.lang.ClassNotFoundException: org.springframework.http.client.BasicAuthorizationInterceptor at java.net.URLClassLoader.findClass(URLClassLoader.java:381)[na:1.8.0_73] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)[na:1.8.0_73] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)[na:1.8.0_73] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[na:1.8.0_73] ... 24 more

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

HronomHronom
9 times, last one
Unknown visitor
Unknown visitor3 times, last one
Unknown visitor
Unknown visitorOnce,
Unknown visitor
Unknown visitorOnce,
andyglickandyglick
10 times, last one
1513 more bugmates