question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fails to start with Spring boot 2.5

See original GitHub issue

Hi there. I’m trying to make this server work with spring boot 2.5.1, but it fails to start with the stack trace below. Do you have any idea how to fix this? Thanks

. ____ _ __ _ _ /\ / __ _ () __ __ _ \ \ \
( ( )_
_ | '_ | '| | ’ / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) ) ’ |
| .__|| ||| |_, | / / / / =========||==============|/=//// :: Spring Boot :: (v2.5.1)

2021-06-12 13:15:05.252 INFO 4953 — [ main] c.b.OAuth2AuthorizationServerApplication : Starting OAuth2AuthorizationServerApplication using Java 12.0.2 on Maurices-iMac.local with PID 4953 (/Users/maurice/projects/spring-authorization-server/target/classes started by maurice in /Users/maurice/projects/spring-authorization-server) 2021-06-12 13:15:05.258 INFO 4953 — [ main] c.b.OAuth2AuthorizationServerApplication : No active profile set, falling back to default profiles: default 2021-06-12 13:15:13.294 INFO 4953 — [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9000 (http) 2021-06-12 13:15:13.374 INFO 4953 — [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2021-06-12 13:15:13.375 INFO 4953 — [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.46] 2021-06-12 13:15:13.817 INFO 4953 — [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2021-06-12 13:15:13.818 INFO 4953 — [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 8129 ms 2021-06-12 13:15:14.500 WARN 4953 — [ main] o.s.security.core.userdetails.User : User.withDefaultPasswordEncoder() is considered unsafe for production and is only intended for sample applications. 2021-06-12 13:15:20.385 WARN 4953 — [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘authorizationServerSecurityFilterChain’ defined in class path resource [org/springframework/security/config/annotation/web/configuration/OAuth2AuthorizationServerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.web.SecurityFilterChain]: Factory method ‘authorizationServerSecurityFilterChain’ threw exception; nested exception is java.lang.NullPointerException 2021-06-12 13:15:20.394 INFO 4953 — [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2021-06-12 13:15:20.499 INFO 4953 — [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled. 2021-06-12 13:15:20.656 ERROR 4953 — [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘authorizationServerSecurityFilterChain’ defined in class path resource [org/springframework/security/config/annotation/web/configuration/OAuth2AuthorizationServerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.web.SecurityFilterChain]: Factory method ‘authorizationServerSecurityFilterChain’ threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.8.jar:5.3.8] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.8.jar:5.3.8] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) ~[spring-beans-5.3.8.jar:5.3.8] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.3.8.jar:5.3.8] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-5.3.8.jar:5.3.8] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.8.jar:5.3.8] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.8.jar:5.3.8] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.8.jar:5.3.8] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.8.jar:5.3.8] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.8.jar:5.3.8] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.8.jar:5.3.8] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.8.jar:5.3.8] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.8.jar:5.3.8] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.1.jar:2.5.1] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.5.1.jar:2.5.1] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-2.5.1.jar:2.5.1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.5.1.jar:2.5.1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-2.5.1.jar:2.5.1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[spring-boot-2.5.1.jar:2.5.1] at com.baeldung.OAuth2AuthorizationServerApplication.main(OAuth2AuthorizationServerApplication.java:10) ~[classes/:na] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.web.SecurityFilterChain]: Factory method ‘authorizationServerSecurityFilterChain’ threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.8.jar:5.3.8] at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.8.jar:5.3.8] … 19 common frames omitted Caused by: java.lang.NullPointerException: null at org.springframework.security.config.annotation.web.builders.HttpSecurity.addFilterAtOffsetOf(HttpSecurity.java:2654) ~[spring-security-config-5.5.0.jar:5.5.0] at org.springframework.security.config.annotation.web.builders.HttpSecurity.addFilterAfter(HttpSecurity.java:2645) ~[spring-security-config-5.5.0.jar:5.5.0] at org.springframework.security.config.annotation.web.builders.HttpSecurity.addFilterAfter(HttpSecurity.java:134) ~[spring-security-config-5.5.0.jar:5.5.0] at org.springframework.security.config.annotation.web.configurers.oauth2.server.authorization.OAuth2AuthorizationServerConfigurer.configure(OAuth2AuthorizationServerConfigurer.java:253) ~[spring-security-oauth2-authorization-server-0.1.0.jar:0.1.0] at org.springframework.security.config.annotation.web.configurers.oauth2.server.authorization.OAuth2AuthorizationServerConfigurer.configure(OAuth2AuthorizationServerConfigurer.java:84) ~[spring-security-oauth2-authorization-server-0.1.0.jar:0.1.0] at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.configure(AbstractConfiguredSecurityBuilder.java:349) ~[spring-security-config-5.5.0.jar:5.5.0] at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.doBuild(AbstractConfiguredSecurityBuilder.java:303) ~[spring-security-config-5.5.0.jar:5.5.0] at org.springframework.security.config.annotation.AbstractSecurityBuilder.build(AbstractSecurityBuilder.java:38) ~[spring-security-config-5.5.0.jar:5.5.0] at org.springframework.security.config.annotation.web.configuration.OAuth2AuthorizationServerConfiguration.authorizationServerSecurityFilterChain(OAuth2AuthorizationServerConfiguration.java:41) ~[spring-security-oauth2-authorization-server-0.1.0.jar:5.5.0] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.8.jar:5.3.8] … 20 common frames omitted

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kwoykecommented, Nov 12, 2021

Closed due to lack of activity.

0reactions
kwoykecommented, Oct 19, 2021

We recently upgraded to Spring Boot 2.5.4. The issue should be solved. Please verify.

Read more comments on GitHub >

github_iconTop Results From Across the Web

google cloud platform - Spring Boot - 2.5.4 - Stack Overflow
Spring Boot - 2.5.4 - Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
Read more >
Solve the problem that SpringBoot fails to start after updating ...
SpringBoot project has integrated springfox. After updating SpringBoot to 2.6.0 the application fails to start and throws an exception: ...
Read more >
Spring Boot Error ApplicationContextException - Baeldung
First, let's try to understand what the error message means. “Unable to start ServletWebServerApplicationContext due to missing ...
Read more >
Spring Boot Reference Documentation
Try the How-to documents. They provide solutions to the most common questions. Learn the Spring basics. Spring Boot builds on many other Spring...
Read more >
Releases · spring-projects/spring-boot - GitHub
Provide a configuration property for the observation patterns of Spring ... Native image built with Gradle fails to start when spring-boot-devtools is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found