[Solved] org.yaml.snakeyaml.scanner.ScannerException: while scanning a simple key

The error message is as follows:

13:31:17.438 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.yaml.snakeyaml.scanner.ScannerException: while scanning a simple key
 in 'reader', line 16, column 1:
    jsonFile :
could not find expected ':'
 in 'reader', line 17, column 5:
        #encoding: "GBK"

    at org.yaml.snakeyaml.scanner.ScannerImpl.stalePossibleSimpleKeys(ScannerImpl.java:484)
    at org.yaml.snakeyaml.scanner.ScannerImpl.needMoreTokens(ScannerImpl.java:299)
    at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken (ScannerImpl.java: 247 )
    at org.yaml.snakeyaml.parser.ParserImpl $ ParseBlockMappingKey.produce (ParserImpl.java: 602 )
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:165)


In  application.yml  between key files use a colon: separated, and there is a space between the colon and the value, or to report the above error!

Wrong wording:



Correct writing:

encoding: true


But I gave a space at the beginning, which caused an error.

Error display:


Display correctly:

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *