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

AbstractJackson2HttpMessageConverter is incompatible with Jackson 2.7+ [SPR-13870] #18443

Closed
spring-projects-issues opened this issue Jan 14, 2016 · 3 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: duplicate A duplicate of another issue

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jan 14, 2016

Abhijit Sarkar opened SPR-13870 and commented

AbstractJackson2HttpMessageConverter.getJavaType calls objectMapper.getTypeFactory().constructType(type, contextClass). In Jackson 2.7+, they modified the signature of constructType and it doesn't take a 2nd Class argument anymore. This is breaking everything that uses the AbstractJackson2HttpMessageConverter, including RestTemplate and controllers that output JSON.

AbstractJackson2HttpMessageConverter claims that it is "Compatible with Jackson 2.1 and higher." but that's not true anymore. The newer Jackson has features that are very desirable, like customization options for JDK8 date time, so downgrading is not a viable option for modern clients.

Sample stacktrace:

java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.type.TypeFactory.constructType(Ljava/lang/reflect/Type;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.getJavaType(AbstractJackson2HttpMessageConverter.java:311)
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.canRead(AbstractJackson2HttpMessageConverter.java:146)
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.canRead(AbstractJackson2HttpMessageConverter.java:141)
at org.springframework.web.client.RestTemplate$AcceptHeaderRequestCallback.doWithRequest(RestTemplate.java:706)
at org.springframework.web.client.RestTemplate$HttpEntityRequestCallback.doWithRequest(RestTemplate.java:769)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:594)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:572)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:493)

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

Rob Winch commented

Thanks for the report. Was this mistakenly posted to Spring Security? I believe this should be a Spring Framework issue. If you feel like it belongs with Spring Security, can you elaborate why?

@spring-projects-issues
Copy link
Collaborator Author

Abhijit Sarkar commented

I didn't mean it to be filed against Spring Security. I don't see any option to choose a project. If you do, please change to it Spring Web or Core.

@spring-projects-issues
Copy link
Collaborator Author

Rob Winch commented

I have moved the issue to Spring Framework

@spring-projects-issues spring-projects-issues added type: bug A general bug status: duplicate A duplicate of another issue in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues removed the type: bug A general bug label Jan 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants