简体   繁体   中英

Springfox Swagger returning HttpMediaTypeNotAcceptableException

I configured SpringFox Swagger in my Spring Boot Application. I am seeing HTTP 406 (HttpMediaTypeNotAcceptableException) when I try to access "http://localhost:8080/swagger-ui.html"

2020-06-28 09:13:32.471 DEBUG [,a10cc123103b7668,a10cc123103b7668,false] 9412 --- [nio-8080-exec-7] RequestMappingHandlerMapping : looking up handler for path: /swagger-ui.html
2020-06-28 09:13:32.474 DEBUG [,a10cc123103b7668,a10cc123103b7668,false] 9412 --- [nio-8080-exec-7] m.m.a.ExceptionHandlerExceptionResolver : Using @ExceptionHandler public c.e.c.exception.ApiErrorResponseDetails c.e.c.exception.GlobalExceptionHandler.handleNotAcceptableErrors(java.lang.Exception)
2020-06-28 09:13:32.476 ERROR [,a10cc123103b7668,a10cc123103b7668,false] 9412 --- [nio-8080-exec-7] c.e.c.GlobalExceptionHandler         : [IGNORE] Error occurred HttpMediaTypeNotAcceptableException: Could not find acceptable representation

c.e.c.exception.SeverityException: HttpMediaTypeNotAcceptableException: Could not find acceptable representation

This post helped me. I had extended WebMvcConfiguration for adding cors configuration which was interfering with springboot auto configuration. I removed the class which had WebMvcConfiguration and this resolved the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM