-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Improve Jackson 2.7 compatibility [SPR-13853] #18426
Comments
Juergen Hoeller commented We are aware of this already but unfortunately can't fix this easily since there is no immediate replacement for that particular Juergen |
Juergen Hoeller commented To be clear, this means that the current Spring Framework 4.2.x generation is likely to remain incompatible with Jackson 2.7+ and will rather just keep supporting Jackson 2.1 to 2.6. As of Spring Framework 4.3, we intend to raise this to Jackson 2.6+, with first-class support for Jackson 2.7 and the upcoming 2.8... and avoiding the use of deprecated Jackson API etc so the chances of working with future Jackson versions are as high as possible. Spring Framework 4.3.x will the retain that Jackson 2.6+ baseline for its entire extended support life. Juergen |
Abhijit Sarkar commented
|
Juergen Hoeller commented You can always check https://jira.spring.io/browse/SPR/?selectedTab=com.atlassian.jira.jira-projects-plugin:roadmap-panel for the current dates. At this point, 4.3 RC1 is scheduled for mid March, with GA expected for early May. Is there a specific need for Jackson 2.7 on your side, beyond what Jackson 2.6.4 can do for you? Juergen |
Abhijit Sarkar commented
We were on Jackson 2.5 and needed this - After the issue with Jackson 2.7, I found out that 2.6.4 also has this attribute so I can live with that. However, as a general rule, I try not to write software that only works with a certain dependency version. I'll wait until the fix comes out to upgrade Spring as well as Jackson. Thanks for your response. |
Elad Tabak commented I'm facing a similar issue, using spring 4.2.4 (latest) and jackson 2.7.1 (also latest). java.lang.IllegalArgumentException: Unrecognized Type: [null]
com.fasterxml.jackson.databind.type.TypeFactory._fromAny(TypeFactory.java:1109)
com.fasterxml.jackson.databind.type.TypeFactory.constructType(TypeFactory.java:566)
com.fasterxml.jackson.databind.type.TypeFactory.constructType(TypeFactory.java:602)
org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.getJavaType(AbstractJackson2HttpMessageConverter.java:311)
org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.writeInternal(AbstractJackson2HttpMessageConverter.java:249)
org.springframework.http.converter.AbstractGenericHttpMessageConverter.write(AbstractGenericHttpMessageConverter.java:100) I was able to identify that the AbstractJackson2HttpMessageConverter.getJavaType() method on line 249 sends the second argument as null, instead of providing the class of the object/value as needed. Using a debugger I managed to change the null with the object class, and it worked. This seems to be an easy fix for future versions of spring, to support jackson 2.7.1+. It also relates to this bug that does not seem to be resolved in spring 4.2.4, as the second argument is still null: |
Juergen Hoeller commented Indeed, Jackson 2.6's At the same time, 4.3 features a refactored approach where this problem doesn't appear anymore: see #18301. This needs to go through the 4.3 RC phase yet though. Juergen |
Sébastien Deleuze commented This commit introduces the conditional call proposed by Juergen Hoeller in It allows to use Spring Framework 4.2.x with Jackson 2.7.1+ for most use cases, but with some limitations. For example, with Jackson 2.7 As a consequence, after this commit Spring Framework 4.2.x still fully supports Jackson up to version 2.6, but improves Jackson 2.7 compatibility. Full support for Jackson 2.7 is provided as of Spring Framework 4.3.x. |
Elad Tabak commented Sébastien thank you very much for the quick fix! |
Sébastien Deleuze commented Juergen Hoeller I just found this Jackson issue that shows that Jackson 2.7.2 will work fine with |
Juergen Hoeller commented I guess since that code is just more defensive but otherwise functionally equivalent, there's nothing wrong with keeping it either? |
Sébastien Deleuze commented Indeed, and since we are not sure when Jackson 2.7.2 will be released, it still can help users. |
Marek Wiącek opened SPR-13853 and commented
RestTemplate produces the following error when used with Jackson 2.7.0-rc3:
Caused by: 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:314)
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.doExecute(RestTemplate.java:594)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:557)
at org.springframework.web.client.RestTemplate.getForEntity(RestTemplate.java:289)
Affects: 4.2.3, 4.2.4
Issue Links:
Referenced from: commits 09db26a
1 votes, 9 watchers
The text was updated successfully, but these errors were encountered: