Skip to content

new ObjectMapper().readTree() throws exceptions since v2.15.1 (fixed in 2.15.2) #3955

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

Closed
sblantipodi opened this issue May 29, 2023 · 10 comments

Comments

@sblantipodi
Copy link

sblantipodi commented May 29, 2023

Describe the bug
My software works since years, I updated to databind v2.15.1 and it started throwing exceptions.

Version information
2.15.1

To Reproduce

ObjectMapper mapper = new ObjectMapper();
JsonNode mqttmsg = mapper.readTree(message.getPayload());

where message is MqttMessage from org.eclipse.paho.client.mqttv3 and getPayload() returns byte[].

I have the same problem even with a simple thing like this:
mapper.readTree("{'pippo':'pluto'}");

this is the exception thrown:
java.lang.ClassNotFoundException: com.fasterxml.jackson.core.exc.StreamConstraintsException

this is my POM.xml...

<jackson.version>2.15.1</jackson.version>
<jackson.dataformat.version>2.14.2</jackson.dataformat.version>
<jackson.module.version>2.14.2</jackson.module.version>
<jackson.datatype.version>2.14.2</jackson.datatype.version>

I can't find the update for the other modules in mavencentral

Expected behavior
have it working as always.

@sblantipodi sblantipodi added the to-evaluate Issue that has been received but not yet evaluated label May 29, 2023
@JooHyukKim
Copy link
Member

JooHyukKim commented May 29, 2023

@sblantipodi There must be a mismatch between versions. Could you just try upgrading all Jackson moudles to 2.15 and try again?

I may have to double check tho, but com.fasterxml.jackson.core.exc.StreamConstraintsException might have been introduced in 2.15

@sblantipodi
Copy link
Author

ok I manually updated everything to 2.15.1

<jackson.version>2.15.1</jackson.version>
<jackson.dataformat.version>2.15.1</jackson.dataformat.version>
<jackson.module.version>2.15.1</jackson.module.version>
<jackson.datatype.version>2.15.1</jackson.datatype.version>

but now it doesn't compile:
\src\main\java\module-info.java:14:35 java: module not found: com.fasterxml.jackson.core

@sblantipodi
Copy link
Author

@JooHyukKim 2.15.0 works well...
2.15.1 destroyed everything :D

@pjfanning
Copy link
Member

this is FasterXML/jackson-core#1027

You'll need to wait until jackson 2.15.2, I'm afraid.

@JooHyukKim
Copy link
Member

JooHyukKim commented May 29, 2023

You'll need to wait until jackson 2.15.2, I'm afraid.

Right, as @pjfanning mentions.

I wonder if there is anything we can do, to advise users running into the same issue. 🤔🤔

@sblantipodi
Copy link
Author

ok thanks for the answer :)

@cowtowncoder
Copy link
Member

cowtowncoder commented May 30, 2023

I am planning to release 2.15.2 this week; hopefully today or tomorrow. Fwtw.

Note that the original problem was a simple incompatibility between deployed versions: one MUST NOT try to use older minor version of jackson-core than jackson-databind -- that will not work, is not meant to work.

But there is indeed #1027 which can prevent use on Module-enabled set ups (which means tons of users) :-/

@sblantipodi
Copy link
Author

sblantipodi commented May 30, 2023

@cowtowncoder thanks for the answer.
not all the jackson modules has been pushed on Maven Central at the same time, or IntelliJ doesn't seen the update at the same time.

IntelliJ suggested me an update and I accepted it just to try, for this reason I ended up with this versions:

<jackson.version>2.15.1</jackson.version>
<jackson.dataformat.version>2.14.2</jackson.dataformat.version>
<jackson.module.version>2.14.2</jackson.module.version>
<jackson.datatype.version>2.14.2</jackson.datatype.version>

Glad to see that 2.15.2 is imminent that will fix the 2.15.1 compile error.

@cowtowncoder
Copy link
Member

@sblantipodi It may indeed take 2-3 hours for a complete set to be available, it should never lead to use of inconsistent set, please don't do that. IntelliJ has no idea of constraints (unless you use jackson-bom which is highly recommended). It is too bad Idea suggests use of mismatching versions.

But specifically you should avoid mixing minor versions (2.15 vs 2.14).

@sblantipodi
Copy link
Author

closing since the issue is now solved.

@cowtowncoder cowtowncoder changed the title new ObjectMapper().readTree() throws exceptions since v2.15.1 new ObjectMapper().readTree() throws exceptions since v2.15.1 (fixed in 2.15.2) Jun 20, 2023
@cowtowncoder cowtowncoder added 2.15 and removed to-evaluate Issue that has been received but not yet evaluated labels Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants