'Object Mapper - YAMLFactory - exception due to missing _createContentReference method

I'm using the latest 2.13.0 version of jackson, and when I try to parse a YAML file, I'm getting this exception

 java.lang.NoSuchMethodError: 'com.fasterxml.jackson.core.io.ContentReference com.fasterxml.jackson.dataformat.yaml.YAMLFactory._createContentReference(java.lang.Object)'

What could be the issue?

The dependencies that I've included are jackson-core, jackson-databind and jackson-dataformat-yaml - all 2.13.0



Solution 1:[1]

No such method error in most cases means that you have have 2 dependencies that are the same but with different versions, however the application is loading the version that does not have this method in it,

The reference to this _createContentReference exists in YAMLFactory in jackson-dataformat-yaml.jar

The actual _createContentReference implementation exists in com.fasterxml.jackson.core.JsonFactory which exists jackson-core.2.13.0.

In your case, you probably have another jackson-core.jar with an older version as part of your indirect dependencies.

You can see mvn dependency:tree or your IDE (Such as Eclipse allows you to search for dependency by name, and it returns all that match, including their versions)

Solution 2:[2]

Thanks. It helped me to exclude jackson-dataformat-yaml version 2.13.1 from quarkus-smallrye-openapi and include 2.12.3 . Like this :

    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-smallrye-openapi</artifactId>
        <exclusions>
            <exclusion>
                <groupId>com.fasterxml.jackson.dataformat</groupId>
                <artifactId>jackson-dataformat-yaml</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.dataformat</groupId>
        <artifactId>jackson-dataformat-yaml</artifactId>
        <version>2.12.3</version>
    </dependency>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 perj