When I upgrade snakeyaml from 1.33 to 2.0 version. snakeyaml dependency
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.0</version>
</dependency>
Error log
Exception in thread "main" java.lang.NoSuchMethodError: org.yaml.snakeyaml.parser.ParserImpl.<init>(Lorg/yaml/snakeyaml/reader/StreamReader;)V
at com.fasterxml.jackson.dataformat.yaml.YAMLParser.<init>(YAMLParser.java:159)
at com.fasterxml.jackson.dataformat.yaml.YAMLFactory._createParser(YAMLFactory.java:455)
at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createParser(YAMLFactory.java:357)
at org.elasticsearch.common.xcontent.yaml.YamlXContent.createParser(YamlXContent.java:84)
at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1103)
at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:1086)
at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:83)
at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:100)
at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:91)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126)
at org.elasticsearch.bootstrap.ElasticsearchAdapter.start(ElasticsearchAdapter.java:62)
at org.elasticsearch.bootstrap.ElasticsearchAdapter.main(ElasticsearchAdapter.java:172)
Comment From: wilkinsona
This is out of Spring Boot's control. You either need to avoid using YAML to configure Elasticsearch or you need to use a version of Jackson that's compatible with SnakeYAML 2.0. That appears to be coming in Jackson 2.15: https://github.com/FasterXML/jackson-dataformats-text/pull/390.
Comment From: juan91
Iam using the following dependencies:
implementation group: 'org.yaml', name: 'snakeyaml', version: '2.0'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.15.0'
and I get the following error:
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
com.fasterxml.jackson.dataformat.yaml.YAMLParser.<init>(YAMLParser.java:178)
Correct the classpath of your application so that it contains compatible versions of the classes com.fasterxml.jackson.dataformat.yaml.YAMLParser and org.yaml.snakeyaml.parser.Pars
erImpl
Is there a solution to the previous error?
Comment From: wilkinsona
@juan91 this is no different to the situation above. Perhaps something else in your build means that you aren't actually using Jackson 2.15? It's impossible to tell from two dependency declarations alone. I would use a build scan or gradle dependencies to double-check. If you have any further questions, please follow up on Stack Overflow or Gitter. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.
Comment From: Zgy0806
@juan91 try this