Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 response on /swagger-ui.html #1887

Closed
bitbaggi opened this issue Oct 13, 2022 · 9 comments
Closed

404 response on /swagger-ui.html #1887

bitbaggi opened this issue Oct 13, 2022 · 9 comments
Labels
invalid This doesn't seem right

Comments

@bitbaggi
Copy link

Describe the bug
Hey Guys,

i'm testing the springdoc-openapi-ui with springdoc-openapi-native and spring with native build.
But when i try to access swagger-ui with /swagger-ui.html then spring respond with an 404 page.

To Reproduce
Clone and start this spring project
https://github.com/bitbaggi/test-spring-docs-native
Visit http://localhost:8080/swagger-ui.html

Expected behavior
Swagger-UI opens with this url

@bnasslahsen
Copy link
Contributor

@bitbaggi,

You using wrong version...
If you want use spring-boot-3, try using Spring Boot 3.0.0-M5 with springdoc 2.0.0-M7-SNAPSHOT.

@bnasslahsen bnasslahsen added the invalid This doesn't seem right label Oct 15, 2022
@bitbaggi
Copy link
Author

@bnasslahsen

Can you check again my repository?
Now i use the versions you mentioned.

If i start the project with my ide (IntelliJ) then swagger-ui is working.
But when i build the project with 'gradlew bootBuildImage' its not.

When i load to http://localhost:8080/swagger-ui.html spring redirects me to /swagger-ui/index.html and shows an error 404.
log.txt

Did i anything wrong?

@bnasslahsen
Copy link
Contributor

@bitbaggi,

I believe you are still missing additional configuration.

springdoc.enable-native-support=true

Just try with this one, and let me know :)

I already explained it here: #1284 (comment)

@bitbaggi
Copy link
Author

@bnasslahsen

Okay that's working.

But now i get an exception from api call /v3/api-docs
"java.lang.NoSuchMethodException: No value method found"

exception.txt

Is their anything wrong with my operation annotation?

@Controller
@Tag(name = "Test")
@RequestMapping(path = "api")
public class TestResource {

    @Operation
    @GetMapping(path = "test")
    public ResponseEntity<String> test() {
        return ResponseEntity.ok("Test");
    }
}

@bnasslahsen
Copy link
Contributor

@bitbaggi,

Not reproducible with your sample. Tested on macOS/ Apple M1.
Might be related to your running os/platform ...

Try building your native image in a different platform.

@bitbaggi
Copy link
Author

bitbaggi commented Oct 21, 2022

@bnasslahsen
How did you build it?
With gradlew bootBuildImage?

Or with an other way?

@bnasslahsen
Copy link
Contributor

@bitbaggi,

using:

./gradlew nativeCompile

@nidhikaushal
Copy link

nidhikaushal commented Apr 12, 2023

Hi,
I am facing a similar issue. On accessing https://somecomp.com/service1/swagger-ui.html it redirects to https://somecomp.com/service1/swagger/index.html and then returns error 404.
I am using 'spring-boot-starter-webflux:3.0.3' with 'springdoc-openapi-starter-webflux-ui:2.1.0'. Following is the configuration in my application.yml:

springdoc:
  packagesToScan: com.company
  swagger-ui:
    defaultModelsExpandDepth: -1
    path: "/swagger-ui.html"
  webjars:
      prefix: /service1

Please guide

@matt-hires
Copy link

Maybe this helps: #2204 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

4 participants