The following error occurs mainly because the configuration of the resource server is added, but the service is not identified as a resource server.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfiguration': Post-processing of merged bean definition failed; nested exception is java.lang.TypeNotPresentException: Type javax.servlet.Filter not present
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.5.jar:5.3.5]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.5.jar:5.3.5]
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:63) ~[spring-boot-2.4.4.jar:2.4.4]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:769) [spring-boot-2.4.4.jar:2.4.4]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-2.4.4.jar:2.4.4]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) [spring-boot-2.4.4.jar:2.4.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) [spring-boot-2.4.4.jar:2.4.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1313) [spring-boot-2.4.4.jar:2.4.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) [spring-boot-2.4.4.jar:2.4.4]
at com.zsh.GatewayApplication.main(GatewayApplication.java:16) [classes/:na]
Caused by: java.lang.TypeNotPresentException: Type javax.servlet.Filter not present
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:117) ~[na:1.8.0_261]
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125) ~[na:1.8.0_261]
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) ~[na:1.8.0_261]
at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68) ~[na:1.8.0_261]
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138) ~[na:1.8.0_261]
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) ~[na:1.8.0_261]
at sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(ClassRepository.java:108) ~[na:1.8.0_261]
at java.lang.Class.getGenericInterfaces(Class.java:913) ~[na:1.8.0_261]
at org.springframework.core.ResolvableType.getInterfaces(ResolvableType.java:502) ~[spring-core-5.3.5.jar:5.3.5]
at org.springframework.core.ResolvableType.as(ResolvableType.java:450) ~[spring-core-5.3.5.jar:5.3.5]
at org.springframework.core.ResolvableType.as(ResolvableType.java:451) ~[spring-core-5.3.5.jar:5.3.5]
at org.springframework.core.ResolvableType.as(ResolvableType.java:456) ~[spring-core-5.3.5.jar:5.3.5]
at org.springframework.core.ResolvableType.as(ResolvableType.java:456) ~[spring-core-5.3.5.jar:5.3.5]
at org.springframework.core.ResolvableType.forMethodParameter(ResolvableType.java:1341) ~[spring-core-5.3.5.jar:5.3.5]
at org.springframework.core.ResolvableType.forMethodParameter(ResolvableType.java:1324) ~[spring-core-5.3.5.jar:5.3.5]
at org.springframework.core.ResolvableType.forMethodParameter(ResolvableType.java:1291) ~[spring-core-5.3.5.jar:5.3.5]
at org.springframework.core.ResolvableType.forMethodParameter(ResolvableType.java:1281) ~[spring-core-5.3.5.jar:5.3.5]
at org.springframework.core.BridgeMethodResolver.isResolvedTypeMatch(BridgeMethodResolver.java:157) ~[spring-core-5.3.5.jar:5.3.5]
at org.springframework.core.BridgeMethodResolver.isBridgeMethodFor(BridgeMethodResolver.java:141) ~[spring-core-5.3.5.jar:5.3.5]
at org.springframework.core.BridgeMethodResolver.searchCandidates(BridgeMethodResolver.java:120) ~[spring-core-5.3.5.jar:5.3.5]
at org.springframework.core.BridgeMethodResolver.findBridgedMethod(BridgeMethodResolver.java:82) ~[spring-core-5.3.5.jar:5.3.5]
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.lambda$buildResourceMetadata$1(CommonAnnotationBeanPostProcessor.java:390) ~[spring-context-5.3.5.jar:5.3.5]
at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:324) ~[spring-core-5.3.5.jar:5.3.5]
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.buildResourceMetadata(CommonAnnotationBeanPostProcessor.java:389) ~[spring-context-5.3.5.jar:5.3.5]
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.findResourceMetadata(CommonAnnotationBeanPostProcessor.java:347) ~[spring-context-5.3.5.jar:5.3.5]
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:295) ~[spring-context-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1098) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576) ~[spring-beans-5.3.5.jar:5.3.5]
... 16 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.servlet.Filter
at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_261]
at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_261]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) ~[na:1.8.0_261]
at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_261]
at java.lang.Class.forName0(Native Method) ~[na:1.8.0_261]
at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_261]
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114) ~[na:1.8.0_261]
... 43 common frames omitted
2021-10-31 18:29:13.998 WARN 8204 --- [ Thread-8] c.a.n.common.http.HttpClientBeanHolder : [HttpClientBeanHolder] Start destroying common HttpClient
2021-10-31 18:29:13.998 WARN 8204 --- [ Thread-8] c.a.n.common.http.HttpClientBeanHolder : [HttpClientBeanHolder] Destruction of the end
Process finished with exit code 1
There are two main solutions to this problem
First: remove the configuration of the resource server
Second: add the @ enableresourceserver annotation on the startup class
Start again to succeed!
Read More:
- Error creating bean with name ‘feignTargeter‘ defined in class path resource [org/springframework/cl
- org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name
- org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘use
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘serviceImpl‘
- org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file
- shiro Error org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type
- Spring configuration error: org.springframework.beans . factory.BeanCreationException : Error creating bean with name ‘m
- NoClassDefFoundError: org.springframework.validation.annotation.ValidationAnnotationUtils
- Caused by: org.springframework.beans.factory.beancreationexception: error creating be
- Error creating bean with name ‘requestMappingHandlerAdapter‘ defined in class path resource
- Error in project operation org.springframework.beans . factory.BeanCreationException : error creating bean with name can be configured by
- Spring nested exception is java.lang.NoClassDefFoundError: org/springframework/core/MethodClassKey
- Solution in idea java.lang.ClassNotFoundException : org.springframework.web . context.ContextLoaderListener
- org.springframework.dao.InvalidDataAccessApiUsageException: Bean object must not be null; nested exc
- Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of ty
- When SSM + Maven project is running, it is prompted that org.springframework.web.servlet.dispatcherserservlet cannot be found
- Spring Cloud:org.springframework.web.client.HttpClientErrorException: 404 null
- [Solved] Access /oauth/token in SpringCloud OAuth2 and report server_error
- Error creating bean with name usercontroller appears when springboot starts