3

On using jackson version 2.13.2

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

I get the following exception when parsing the yaml

Exception in thread "main" java.lang.NoSuchMethodError: 'com.fasterxml.jackson.core.io.ContentReference com.fasterxml.jackson.dataformat.yaml.YAMLFactory._createContentReference(java.lang.Object)'
    at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createParser(YAMLFactory.java:374)
    at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createParser(YAMLFactory.java:348)
    at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createParser(YAMLFactory.java:15)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3468)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3436)
    at Scratch.main(scratch.java:13)

but this doesnt seem to be a problem for the older version of the library 2.12.x

        String content = new String(Files.readAllBytes(Paths.get(commonYaml)));
        ObjectMapper yamlReader = new ObjectMapper(YAMLFactory.builder().build());
        Object obj = yamlReader.readValue(content, Object.class);
        ObjectMapper jsonWriter = new ObjectMapper();
        String json = jsonWriter.writeValueAsString(obj);

Is there a change in the API or is this a bug in the version

Ouroborus
  • 16,237
  • 4
  • 39
  • 62
jtkSource
  • 675
  • 9
  • 21

0 Answers0