Today, I reported an error when I was going to learn something new and build a new project integration swagger.
org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.15.jar:5.3.15]
at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_241]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.3.jar:2.6.3]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) [spring-boot-2.6.3.jar:2.6.3]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:414) [spring-boot-2.6.3.jar:2.6.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) [spring-boot-2.6.3.jar:2.6.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) [spring-boot-2.6.3.jar:2.6.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) [spring-boot-2.6.3.jar:2.6.3]
at com.hf.logisticsinfo.LogisticsInfoApplication.main(LogisticsInfoApplication.java:10) [classes/:na]
Caused by: java.lang.NullPointerException: null
at springfox.documentation.spi.service.contexts.Orderings$8.compare(Orderings.java:112) ~[springfox-spi-2.9.2.jar:null]
at springfox.documentation.spi.service.contexts.Orderings$8.compare(Orderings.java:109) ~[springfox-spi-2.9.2.jar:null]
at com.google.common.collect.ComparatorOrdering.compare(ComparatorOrdering.java:37) ~[guava-20.0.jar:na]
at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) ~[na:1.8.0_241]
at java.util.TimSort.sort(TimSort.java:220) ~[na:1.8.0_241]
at java.util.Arrays.sort(Arrays.java:1438) ~[na:1.8.0_241]
at com.google.common.collect.Ordering.sortedCopy(Ordering.java:855) ~[guava-20.0.jar:na]
at springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider.requestHandlers(WebMvcRequestHandlerProvider.java:57) ~[springfox-spring-web-2.9.2.jar:null]
at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper$2.apply(DocumentationPluginsBootstrapper.java:138) ~[springfox-spring-web-2.9.2.jar:null]
at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper$2.apply(DocumentationPluginsBootstrapper.java:135) ~[springfox-spring-web-2.9.2.jar:null]
at com.google.common.collect.Iterators$7.transform(Iterators.java:750) ~[guava-20.0.jar:na]
at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:47) ~[guava-20.0.jar:na]
at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:47) ~[guava-20.0.jar:na]
at com.google.common.collect.MultitransformedIterator.hasNext(MultitransformedIterator.java:52) ~[guava-20.0.jar:na]
at com.google.common.collect.MultitransformedIterator.hasNext(MultitransformedIterator.java:50) ~[guava-20.0.jar:na]
at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:249) ~[guava-20.0.jar:na]
at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:209) ~[guava-20.0.jar:na]
at com.google.common.collect.FluentIterable.toList(FluentIterable.java:614) ~[guava-20.0.jar:na]
at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.defaultContextBuilder(DocumentationPluginsBootstrapper.java:111) ~[springfox-spring-web-2.9.2.jar:null]
at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.buildContext(DocumentationPluginsBootstrapper.java:96) ~[springfox-spring-web-2.9.2.jar:null]
at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.start(DocumentationPluginsBootstrapper.java:167) ~[springfox-spring-web-2.9.2.jar:null]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.15.jar:5.3.15]
... 14 common frames omitted
The general reason is that due to the springboot version problem, the default strategy for matching the request path after 2.6 and spring MVC processing mapping has been changed from antpathmatcher to pathpatternparser.
So the solution here is also very simple
The first solution is to set up spring according to the official prompts mvc.pathmatch.Matching strategy is ant path matcher, which is effective and available for personal testing;
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
The second solution is to directly reduce the springboot version. I’ll try to reduce it to level 2.4 here. There’s no problem
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
Read More:
- SpringBoot High Version Import Swagger 2.9.2 Error: ApplicationContextException: Failed to start bean ‘documentationPluginsBootstrapper‘
- [Solved] swagger3 Error: org.springframework.context.ApplicationContextException: Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException
- [Solved] Swagger Startup Error: Failed to start bean ‘documentationPluginsBootstrapper‘
- [Solved] SpringBoot Integrates Swagge Error: Failed to start bean ‘documentationPluginsBootstrapper‘
- [Solved] Springboot project Create to start Error: APPLICATION FAILED TO START
- [Solved] UNABLE TO START SERVLETWEBSERVERAPPLICATIONCONTEXT DUE TO MISSING SERVLETWEBSERVERFACTORY BEAN
- [Solved] SpringBoot Project Start Error: No bean named ‘org.springframework.context.xxxxx.importRegistry‘ available
- Eclipse start project error: Errors occurred during the build. Errors running builder ‘Integrated External Tool Builder’ on…
- [Solved] Springboot Error: org.apache.catalina.core.ContainerBase : A child container failed during start
- [Sp;ved] Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ssm]
- Android studio can’t start, running error: warning: crash service did not start
- How to Solve Internal Server Error: /swagger/v1/swagger.json
- [Solved] swagger Error: Fetch errorInternal Server Error /swagger/v1/swagger.jso
- nacos Start Error: Error creating bean with name ‘grpcClusterServer’
- How to Solve Application failed to start error
- [Solved] Tomcat Error: Failed to start componen
- Tomcat startup error: Failed to start component [StandardServer[8005]] solution
- OpenCV VideoWriter Failed to Start [How to Solve]
- [Solved] PySide2 Error: This application failed to start because no Qt platform plugin could be initialized
- [Solved] ENSP Failed to Start AR Device error code: 40