Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve snakeyaml NoSuchMethodError: getStyle()

In my spring boot application, I am using snakeyaml to parse a YAML file. I get the following error though when using the library:

java.lang.NoSuchMethodError: org.yaml.snakeyaml.nodes.ScalarNode.getStyle()Ljava/lang/Character;

I am using the following maven dependency:

<dependency>
  <groupId>org.yaml</groupId>
  <artifactId>snakeyaml</artifactId>
  <version>1.21</version>
</dependency>

Does anyone have a hint for resolving this error?

Edit:

The error seems to occur when parsing spring's application.yml:

server:
  port: 8084
like image 397
user2035039 Avatar asked Jun 13 '18 10:06

user2035039


1 Answers

You need to update to SnakeYml 1.23, they fixed the incompatible API change introduced in 1.20.

<dependency>
  <groupId>org.yaml</groupId>
  <artifactId>snakeyaml</artifactId>
  <version>1.23</version>
</dependency>
like image 200
Leonard Brünings Avatar answered Sep 18 '22 04:09

Leonard Brünings