Search code examples
javajacksonjackson-databindjackson-dataformat-yaml

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

  • 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)