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.

Unable to scan documentation context default java.lang.NullPointerException: null

See original GitHub issue

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 3.0.0-SNAPSHOT

What kind of issue is this?

  • Question. Is this a question about how to do a certain thing? no it is not.
  • Bug report. If you’ve found a bug, spend the time to write a failing test. Bugs with tests or steps to reproduce get fixed faster. Here’s an example: https://gist.github.com/swankjesse/6608b4713ad80988cdc9
    • spring xml/java config that is relevant
    • springfox specific configuration if it makes sense
    • include any output you’ve received; logs, json snippets etc.; and what the expected output should be I have a production ready Spring Boot project which until last week works fine(swagger part). And after one deploy yesterday, suddenly we cannot access the swagger page. The url was https://our-api-root/swagger-ui.html.

I see this exception when I launch the project locally(the bootrun works but with this error):

Unable to scan documentation context default java.lang.NullPointerException: null
	at springfox.documentation.spi.schema.contexts.ModelContext.<init>(ModelContext.java:89)
	at springfox.documentation.spi.schema.contexts.ModelContext.fromParent(ModelContext.java:264)
	at springfox.documentation.schema.ModelReferenceProvider.typeName(ModelReferenceProvider.java:108)
	at springfox.documentation.schema.ModelReferenceProvider.modelReference(ModelReferenceProvider.java:71)
	at springfox.documentation.schema.ModelReferenceProvider.apply(ModelReferenceProvider.java:61)
	at springfox.documentation.schema.ModelReferenceProvider.apply(ModelReferenceProvider.java:39)
	at springfox.documentation.schema.ModelProperty.updateModelRef(ModelProperty.java:128)
	at springfox.documentation.spring.web.scanners.ApiModelReader.findSameModels(ApiModelReader.java:322)
	at springfox.documentation.spring.web.scanners.ApiModelReader.mergeModelBranch(ApiModelReader.java:245)
	at springfox.documentation.spring.web.scanners.ApiModelReader.lambda$mergeModelBranch$8(ApiModelReader.java:192)
	at java.base/java.util.Optional.orElseGet(Optional.java:369)
	at springfox.documentation.spring.web.scanners.ApiModelReader.mergeModelBranch(ApiModelReader.java:192)
	at springfox.documentation.spring.web.scanners.ApiModelReader.lambda$read$4(ApiModelReader.java:145)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654)
	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.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
	at springfox.documentation.spring.web.scanners.ApiModelReader.read(ApiModelReader.java:144)
	at springfox.documentation.spring.web.scanners.ApiListingScanner.scan(ApiListingScanner.java:144)
	at springfox.documentation.spring.web.scanners.ApiDocumentationScanner.scan(ApiDocumentationScanner.java:69)
	at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.scanDocumentation(AbstractDocumentationPluginsBootstrapper.java:97)
	at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.bootstrapDocumentationPlugins(AbstractDocumentationPluginsBootstrapper.java:83)
	at springfox.documentation.spring.web.plugins.SpringIntegrationDocumentationPluginsBootstrapper.contextRefreshedEventExecute(SpringIntegrationDocumentationPluginsBootstrapper.java:81)
	at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:305) [4 skipped]
	at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:190)
	at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:153)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:897)
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.finishRefresh(ReactiveWebServerApplicationContext.java:129)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
	at eu.vptech.checkoutexp.checkout.CheckoutApplication.main(CheckoutApplication.java:11)
- [ ] if you have a repo that demonstrates the issue for bonus points! See [this example](https://github.com/springfox/springfox/issues/494) 

Tried to reproduce it with a simple demo project but failed.

  • Feature Request. Start by telling us what problem you’re trying to solve. Often a solution already exists! Don’t send pull requests to implement new features without first getting our support. Sometimes we leave features out on purpose to keep the project small.

Please do consider starring this repository if you do like this project and find it useful.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:53 (31 by maintainers)

github_iconTop GitHub Comments

3reactions
MaksimOrlovcommented, May 5, 2020

I think that is better to check for NULL and then use LOG.warn() . I will return that fuse, I shouldn’t have removed it. That is refactor issue. Will submit a PR tomorrow.

Adding @ApiModel is not required, just if you wish. Merging algorithm must render declaration as is.

2reactions
WesleyBlancoYuancommented, Jul 8, 2020

@WesleyBlancoYuan could you confirm this is fixed in the latest SNAPSHOT build? /c @MaksimOrlov

Yes it is. I now close this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Unable to scan documentation context default solution ...
Unable to scan documentation context default solution appears when Swagger2 starts ... NullPointerException: null at java.lang.String.
Read more >
java - Swagger 2 Issue - Spring Boot - Stack Overflow
I wonder now if there is a way to fix this. SwaggerConfig: package com.animes.apirest.config; import springfox.documentation.swagger2.
Read more >
Unable to scan documentation context default java.lang ...
运行springboot项目报错Unable to scan documentation context default java.lang.NullPointerException: null at ...
Read more >
Unable to scan documentation context default java.lang ...
运行springboot项目报错. Unable to scan documentation context default java.lang.NullPointerException: null at springfox.documentation.spi.schema.contexts.
Read more >
Swagger of Java project reports an error - Programming VIP
... Unable to scan documentation context default java.lang.NullPointerException: null at springfox.documentation.schema.
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