Total Pageviews

2019/03/13

[Spring boot] org.yaml.snakeyaml.scanner.ScannerException: mapping values are not allowed here

Problem
When I tried to startup my spring boot project, I got this exception:
Caused by: org.yaml.snakeyaml.scanner.ScannerException: mapping values are not allowed here
 in 'reader', line 16, column 17:
        diskdrive: C:
                    ^

 at org.yaml.snakeyaml.scanner.ScannerImpl.fetchValue(ScannerImpl.java:872)
 at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:360)
 at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:226)
 at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:557)
 at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:157)
 at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:147)
 at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:227)
 at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:154)
 at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:249)
 at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:240)
 at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:228)
 at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:154)
 at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:249)
 at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:240)
 at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:228)
 at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:154)
 at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:122)
 at org.yaml.snakeyaml.composer.Composer.getNode(Composer.java:84)
 at org.yaml.snakeyaml.constructor.BaseConstructor.getData(BaseConstructor.java:123)
 at org.yaml.snakeyaml.Yaml$1.next(Yaml.java:547)

Here had part of application.yml
opendata:
  file:
    diskdrive: C:
    subdirectory: opendata



How-To
I should add double quote to C: in head and tail. application.yml should modify as bellows:
opendata:
  file:
    diskdrive: "C:"
    subdirectory: opendata




No comments: