Question Conflicting jackson-databind versions starting in 1.21.3

CrazyCranberry

New member
Jan 20, 2025
2
0
1
Hello!

My mini-golf plugin serializes and deserializes yaml for course information. I'm using the com.fasterxml.jackson.dataformat.jackson-dataformat-yaml dependency to do so. My plugin stopped working with the release of paper 1.21.3; methods from within my dependencies were missing. I'm understanding the issues to be a result of conflicting jackson-databind versions (jackson-databind is a dependency of jackson-dataformat-yaml). My plugin is currently using jackson-dataformat-yaml version 2.16.1 but it looks like paper is using a version of jackson-databind-2.13.4.2. If I lower my version of jackson-dataformat-yaml to 2.13.4 (there is no 2.13.4.2) I then get a similar error about snakeyaml.

This may be a straight java question, but how can I force my plugin to use the version of dependencies I declare in my pom.xml?


Initial error log:
Code:
[16:47:01 ERROR]: Error occurred while enabling MiniGolf v3.1 (Is it up to date?)
java.lang.NoSuchMethodError: 'void com.fasterxml.jackson.dataformat.yaml.YAMLParser.createChildObjectContext(int, int)'
        at miniGolf-3.1.jar/com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:531) ~[miniGolf-3.1.jar:?]
        at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4761) ~[jackson-databind-2.13.4.2.jar:2.13.4.2]
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4667) ~[jackson-databind-2.13.4.2.jar:2.13.4.2]
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3494) ~[jackson-databind-2.13.4.2.jar:2.13.4.2]
        at miniGolf-3.1.jar/com.chai.miniGolf.configs.MiniGolfConfig.lambda$loadCourses$1(MiniGolfConfig.java:86) ~[miniGolf-3.1.jar:?]
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]

Error log after switch to 2.13.4
Code:
[16:56:36 ERROR]: Error occurred while enabling MiniGolf v3.1 (Is it up to date?)
java.lang.NoSuchMethodError: 'void org.yaml.snakeyaml.parser.ParserImpl.<init>(org.yaml.snakeyaml.reader.StreamReader)'
        at miniGolf-3.1.jar/com.fasterxml.jackson.dataformat.yaml.YAMLParser.<init>(YAMLParser.java:178) ~[miniGolf-3.1.jar:?]
        at miniGolf-3.1.jar/com.fasterxml.jackson.dataformat.yaml.YAMLFactory._createParser(YAMLFactory.java:466) ~[miniGolf-3.1.jar:?]
        at miniGolf-3.1.jar/com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createParser(YAMLFactory.java:354) ~[miniGolf-3.1.jar:?]
        at miniGolf-3.1.jar/com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createParser(YAMLFactory.java:15) ~[miniGolf-3.1.jar:?]
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3494) ~[jackson-databind-2.13.4.2.jar:2.13.4.2]
        at miniGolf-3.1.jar/com.chai.miniGolf.configs.MiniGolfConfig.lambda$loadCourses$1(MiniGolfConfig.java:86) ~[miniGolf-3.1.jar:?]
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
 

LoJoSho

New member
Jan 4, 2022
20
7
3
You should just be able to shade the dependency, and then relocate it within your jar. That way, your plugin will not get confused with other dependencies that are there.