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

Upgrade to Jackson 2.9 GA [SPR-15548] #20107

Closed
spring-issuemaster opened this issue May 15, 2017 · 5 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented May 15, 2017

Juergen Hoeller opened SPR-15548 and commented


Affects: 5.0 RC3

Issue Links:

  • #19492 Support for Jackson 2.9
  • #19097 Leverage Jackson non-blocking JSON parsing (and remove netty-buffer dependency)

0 votes, 6 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 28, 2017

Sébastien Deleuze commented

With #19097 resolution by Arjen, I think we are just waiting Jackson 2.9.0 GA to be available in order to be able to resolve this issue.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 26, 2017

Vladimir Tsanev commented

Currently jackson 2.8 support is broken. Is this expected? is spring 5 going to work with jackson 2.9+ only?

Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException
	at org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init>(AllEncompassingFormHttpMessageConverter.java:67)
	at demo.Demo.main(Demo.java:11)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 7 more
@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 26, 2017

Juergen Hoeller commented

We're currently indeed requiring Jackson 2.9 in several places. It'll be mandatory in WebFlux for sure, and it also has technical benefits in other converters, so we're likely to decide on a hard Jackson 2.9+ requirement for GA. We need the Jackson 2.9 roadmap to work out first though, with a 2.9 GA release and ideally a 2.9.1 (as a sign of active maintenance) already by the time that we go live in September.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 31, 2017

Stéphane Nicoll commented

The upgrade to 2.9 broke three tests, the common reason is this new StaxUtil#throwAsParseException that will generate a JsonParseException. Our mapper handles that and throws a HttpMessageNotReadableException while it was previously throwing an IOException.

I am not sure if we can safely adapt those tests and just include the new exception type as part of the migration.

MappingJackson2XmlHttpMessageConverterTests readInvalidXml History
java.lang.Exception: java.lang.Exception: Unexpected exception, expected<java.io.IOException> but was<org.springframework.http.converter.HttpMessageNotReadableException>
java.lang.Exception: Unexpected exception, expected<java.io.IOException> but was<org.springframework.http.converter.HttpMessageNotReadableException>
	at org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:28)
	at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:239)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
(66 more lines...)
Failed	MappingJackson2XmlHttpMessageConverterTests readWithExternalReference History
java.lang.AssertionError: java.lang.AssertionError: 
Expected: an instance of java.io.IOException
     but: <org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Undeclared general entity "ext"
 at [row,col {unknown-source}]: [2,186]; nested exception is com.fasterxml.jackson.core.JsonParseException: Undeclared general entity "ext"
 at [row,col {unknown-source}]: [2,186]
 at [Source: (ByteArrayInputStream); line: 2, column: 187]> is a org.springframework.http.converter.HttpMessageNotReadableException
Stacktrace was: org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Undeclared general entity "ext"
 at [row,col {unknown-source}]: [2,186]; nested exception is com.fasterxml.jackson.core.JsonParseException: Undeclared general entity "ext"
(206 more lines...)
Failed	MappingJackson2XmlHttpMessageConverterTests readWithXmlBomb History
java.lang.AssertionError: java.lang.AssertionError: 
Expected: an instance of java.io.IOException
     but: <org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Undeclared general entity "lol9"
 at [row,col {unknown-source}]: [15,14]; nested exception is com.fasterxml.jackson.core.JsonParseException: Undeclared general entity "lol9"
 at [row,col {unknown-source}]: [15,14]
 at [Source: (ByteArrayInputStream); line: 15, column: 15]> is a org.springframework.http.converter.HttpMessageNotReadableException
Stacktrace was: org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Undeclared general entity "lol9"
 at [row,col {unknown-source}]: [15,14]; nested exception is com.fasterxml.jackson.core.JsonParseException: Undeclared general entity "lol9"
(204 more lines...)
@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 31, 2017

Arjen Poutsma commented

I think we can safely change those expected exceptions to the new types. The point is that an exception is thrown for these scenarios; it does not really matter which kind.

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