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

UnsupportedMediaTypeException Should Contain Details of the Resolvable Type [SPR-17346] #21880

spring-issuemaster opened this issue Oct 5, 2018 · 1 comment


Copy link

@spring-issuemaster spring-issuemaster commented Oct 5, 2018

garyodam opened SPR-17346 and commented

When a HttpMessageReader can't be found to read a message in org.springframework.web.reactive.function.BodyExtractors#readWithMessageReaders an UnsupportedMediaTypeException is thrown. The UnsupportedMediaTypeException only includes content type from the input message in the exception when the canRead method used to check whether a HttpMessageReader can read the message can return false if the HttpMessageReader doesn't support the resolvable type of the message as well as its' content type.

I encountered the error message:

org.springframework.web.reactive.function.UnsupportedMediaTypeException: Content type 'application/x-jackson-smile;charset=UTF-8' not supported 

This was misleading because the problem was nothing to do with not supporting the content type. It was because the SmileFactory that the WebClient had in its exchange strategy did not have the GuavaModule added to it. Had the error message indicated that the type that I was trying to deserialze to could be the problem as well as content type then I think it's likely I would have recognized the root cause without resorting to debugging the code to see what was happening.

I've attached a sample project. The problem should be apparent from running spring.webflux.BodyExtractorsTest or mvn test. There's some extra docs in spring.webflux.BodyExtractorsTest.

Affects: 5.0.9


Issue Links:

  • #21345 Improve UnsupportedMediaTypeException and UnsupportedMediaTypeStatusException to include body type ("duplicates")

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 8, 2018

Juergen Hoeller commented

This looks like a duplicate of #21345 which we have addressed for 5.1 already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.