springfox: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException in 2.5.0-SNAPSHOT
Please take the time to search the repository, if your question has already been asked or answered.
- What version of the library are you using? Is it the latest version? The latest released version is [ ![Download]
We are using 3.0.0
bug report
We are using spring boot version is 2.5.0-SNAPSHOT, https://repo.spring.io/snapshot as plugin repository It was OK a few days ago, This problem occurred when I recompiled today
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.6.jar:5.3.6]
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.6.jar:5.3.6]
at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_77]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.0-20210413.204210-414.jar:2.5.0-SNAPSHOT]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:772) [spring-boot-2.5.0-20210413.204210-414.jar:2.5.0-SNAPSHOT]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:441) [spring-boot-2.5.0-20210413.204210-414.jar:2.5.0-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) [spring-boot-2.5.0-20210413.204210-414.jar:2.5.0-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1350) [spring-boot-2.5.0-20210413.204210-414.jar:2.5.0-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1339) [spring-boot-2.5.0-20210413.204210-414.jar:2.5.0-SNAPSHOT]
at com.example.demo.DemoApplication.main(DemoApplication.java:12) [classes/:na]
Caused by: java.lang.NullPointerException: null
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 40
Commits related to this issue
- Changed maven version due Failed to start bean 'documentationPluginsBootstrapper' https://github.com/springfox/springfox/issues/3791 — committed to RobinDeClerck/brank-edge-service by RobinDeClerck 2 years ago
- [+] Downgraded Spring Boot due to Springfox https://github.com/springfox/springfox/issues/3791 Switch to SpringDoc — committed to grauds/money.tracker.api by grauds 2 years ago
This issue has been automatically closed because it has not had recent activity. Please re-open a new issue if this is still an issue.
I recommend switching to Springdoc
Yes, with Spring Boot 2.6.0 it does not work, with 2.5.6 or 2.5.7 it does.
Strange, for me it works with Spring 2.5.5 but not with 2.6.0
Found a hint at https://stackoverflow.com/questions/70036953/springboot-2-6-0-spring-fox-3-failed-to-start-bean-documentationpluginsboot to set spring.mvc.pathmatch.matching-strategy to ant-path-matcher but the problem persists:
Caused by: 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) at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:120) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) ... 69 more Caused by: java.lang.NullPointerException at springfox.documentation.spring.web.WebMvcPatternsRequestConditionWrapper.getPatterns(WebMvcPatternsRequestConditionWrapper.java:56) at springfox.documentation.RequestHandler.sortedPaths(RequestHandler.java:113) at springfox.documentation.spi.service.contexts.Orderings.lambda$byPatternsCondition$3(Orderings.java:89) at java.base/java.util.Comparator.lambda$comparing$77a9974f$1(Comparator.java:469) at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) at java.base/java.util.TimSort.sort(TimSort.java:220) at java.base/java.util.Arrays.sort(Arrays.java:1515) at java.base/java.util.ArrayList.sort(ArrayList.java:1750) at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:392) at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) at springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider.requestHandlers(WebMvcRequestHandlerProvider.java:81) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.withDefaults(AbstractDocumentationPluginsBootstrapper.java:107) at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.buildContext(AbstractDocumentationPluginsBootstrapper.java:91) at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.bootstrapDocumentationPlugins(AbstractDocumentationPluginsBootstrapper.java:82) at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.start(DocumentationPluginsBootstrapper.java:100) at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
No sure back to 2.5.7 is the best option, at least not in my project. We need to find a solution in 2.6.0 version.
Hi Team,
I am currently using spring boot 2.7.12 version But facing the same issue as above . I used ANT_PATH too but doesn’t work Please help .
spring.mvc.pathmatch.matching-strategy = ANT_PATH_MATCHER
solved my issue Now
Guy i got the same problem. in My case with the h2 database, the solution was add the line “spring.mvc.pathmatch.matching-strategy=ant-path-matcher” at application.properties file … here its my complete file : https://github.com/felipe0059/ToDo-List/blob/versao-deploy/src/main/resources/application.properties
Worked for me too on Sprint boot 2.6.3. The switch was fluid esp with instructions on how to migrate from swaggerfox: https://springdoc.org/#migrating-from-springfox
Have a look at https://github.com/springfox/springfox/issues/3462 It worked for me in Spring Boot 2.6.0. So it should work in 2.6.1 too.
Setting spring.mvc.pathmatch.matching-strategy = ANT_PATH_MATCHER in the properties file worked for me https://webfuse.in/blogs/org-springframework-context-applicationcontextexception-failed-to-start-bean-documentationpluginsbootstrapper-nested-exception-is-java-lang-nullpointerexception/
worked like charm
I am running on
Java 11.0.8
and my project folder is based onSpringboot 2.7.13
pom.xml
SwaggerConfig.java
DemoApplication.java
--Where the Springboot starts–You can remove this if you have this set in the
application.properties
file.It works without it.
Same here with spring boot 2.6.2 and springfox 3.0.0.
Just hit the same issue with Spring Boot 2.6.0. Switched back to 2.5.7 and set the following dependencies:
Thanks @natnael-bedru It worked for me with java 11.0.17, Springboot 2.7.16 and
Hi @girish-vm
Even I am in the same situation, please help me if you find the solution. No workarounds fixed the issue. After adding the spring beans manually I am getting a white label error for swagger-ui page.
I have changed our Spring Boot project version from 2.5.0-SNAPSHOT to 2.5.0-M3 It is works now.
I think the reason is that Spring Boot version 2.5.0-SNAPSHOT is unstable