NoSuchMethodError: com.fasterxml.jackson.core.JsonParser.getReadCapabilities()

22 views
Skip to first unread message

Ted Yu

unread,
Jun 6, 2023, 2:52:19 PM6/6/23
to jackson-user
Hi,
We encounter the error shown at the end.

Looking at META-INF/maven/com.fasterxml.jackson.core/jackson-databind/pom.xml in the fat jar:

  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-databind</artifactId>
  <version>2.6.7.1</version>
  <name>jackson-databind</name>

But I don't see 2.6.7 in any pom.xml in our repository.
I checked dependency:tree output as well.

I wonder if someone has hint on how to find where the 2.6.7 dependency came in.

Thanks

        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 org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:355)
        ... 13 more
Caused by: java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonParser.getReadCapabilities()Lcom\/fasterxml\/jackson\/core\/util\/JacksonFeatureSet;
        at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
        at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)
...
        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 org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:344)
        ... 31 more
Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonParser.getReadCapabilities()Lcom\/fasterxml\/jackson\/core\/util\/JacksonFeatureSet;
        at com.fasterxml.jackson.databind.DeserializationContext.<init>(DeserializationContext.java:211)
        at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.<init>(DefaultDeserializationContext.java:50)
        at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext$Impl.<init>(DefaultDeserializationContext.java:391)
        at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext$Impl.createInstance(DefaultDeserializationContext.java:413)
        at com.fasterxml.jackson.databind.ObjectMapper.createDeserializationContext(ObjectMapper.java:4656)
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4585)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3548)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3531)
...
        at org.hibernate.metamodel.model.convert.internal.JpaAttributeConverterImpl.toDomainValue(JpaAttributeConverterImpl.java:45)
        at org.hibernate.type.descriptor.converter.AttributeConverterSqlTypeDescriptorAdapter$2.doConversion(AttributeConverterSqlTypeDescriptorAdapter.java:140)
        at org.hibernate.type.descriptor.converter.AttributeConverterSqlTypeDescriptorAdapter$2.extract(AttributeConverterSqlTypeDescriptorAdapter.java:121)
        at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:261)
        at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:257)
        at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:247)
        at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:333)

Ted Yu

unread,
Jun 6, 2023, 2:54:52 PM6/6/23
to jackson-user
One interesting observation: there is no 2.6.7 directory on local computer:

 ls -lt /Users/zhihongyu/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.6.
2.6.5/ 2.6.6/

This seems to imply that 2.6.7 databind may have come from another fat jar.

Tatu Saloranta

unread,
Jun 6, 2023, 2:55:07 PM6/6/23
to jackso...@googlegroups.com
Version 2.6 is not supported (and hasn't for a while), so I am not
sure how much we can help here with specific details.

But exception message does suggest a version discrepancy: not between
2.6.7.1 and 2.6.7 (those are compatible being patch/micro-path within
same minor release), but by something having later version
(jackson-databind from looks) and requiring matching-or-later
`jackson-core`.
So you do not have a consistent set of Jackson components.

-+ Tatu +-
> --
> You received this message because you are subscribed to the Google Groups "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jackson-user...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-user/5279ce68-9918-4fe1-aca7-94cf2c484be2n%40googlegroups.com.

Ted Yu

unread,
Jun 6, 2023, 3:04:15 PM6/6/23
to jackson-user
Thanks for taking a look.

The jar is produced with `maven-shade-plugin`. Do you have suggestion on how I can trace down the origin of 2.6.7 databind in such scenario ?

Cheers

Tatu Saloranta

unread,
Jun 6, 2023, 3:16:48 PM6/6/23
to jackso...@googlegroups.com
On Tue, Jun 6, 2023 at 12:04 PM Ted Yu <ted...@datavisor.com> wrote:
>
> Thanks for taking a look.
>
> The jar is produced with `maven-shade-plugin`. Do you have suggestion on how I can trace down the origin of 2.6.7 databind in such scenario ?

Something in Maven (etc) build would have dependency. But I am not
sure 2.6.7 of databind should be problematic.
`JacksonFeatureSet` was added in 2.12.0 of `jackson-core` so version
of databind would need to be 2.12 or later (to expect it).
So something is providing `2.6.x` of `jackson-core`; possibly shaded
into some other artifact... so it could definitely come from
non-jackson jar. :-(
I don't know how to figure out where ClassLoader gets particular
classes; chances are it's necessary to see what various jars included
in classpath contain.

-+ Tatu +-
> To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-user/77d71c6a-71d9-4adb-91db-ad99887e92c8n%40googlegroups.com.

Joo Hyuk Kim (김주혁)

unread,
Jun 7, 2023, 7:25:20 AM6/7/23
to jackson-user
This definitely sounds like transitive dependency issue 🥲.

What I can suggest (sadly not a solution) is do some searching around maven how to specify dep. version, override, etc..

Ted Yu

unread,
Jun 7, 2023, 11:41:27 PM6/7/23
to jackson-user
One way we're trying now is to upgrade jackson-core and jackson-databind from 2.9.8 to 2.13.3 across the board (without upgrading projects which depend on jackson-core and jackson-databind).

Tatu: do you anticipate any issue at runtime ?

Thanks

Tatu Saloranta

unread,
Jun 8, 2023, 1:29:55 PM6/8/23
to jackso...@googlegroups.com
On Wed, Jun 7, 2023 at 8:41 PM Ted Yu <ted...@datavisor.com> wrote:
>
> One way we're trying now is to upgrade jackson-core and jackson-databind from 2.9.8 to 2.13.3 across the board (without upgrading projects which depend on jackson-core and jackson-databind).
>
> Tatu: do you anticipate any issue at runtime ?

Unfortunately it is difficult to say in general. For many users it
would just work, but it all depends on kind of usage, esp. whether
there are heavy customizations, use of sub-classing etc. etc.

If possible, I would probably suggest going in smaller steps -- also,
you absolutely want the latest patch of any minor version.
For 2.13 I think there's 2.13.5, and if so there is no reason to
select 2.13.3 (for example).

But if there aren't many customizations, going from 2.9.8 to 2.13.5,
running all test suites, sounds like a good idea.

If you do not trust your test suites, going from 2.9 to, say, 2.10.4
(or whatever latest) first might make sense.

-+ Tatu +-
> To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-user/d2538d63-7c84-42ae-a165-b26aea22b13bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages