Spring-cloud-config: while scanning for the next token found character '@' that cannot start any token.

Created on 25 Oct 2016  路  4Comments  路  Source: spring-cloud/spring-cloud-config

While declaring a property having value like (secret: @t3mokz%OQwkM%fOg#P2) in .yml file throws an error at configuration server.
org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token
found character '@' that cannot start any token. (Do not use @ for indentation)
in 'reader', line 815, column 14:
password: @t3mokz%OQwkM%fOg#P2
^

    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:420) ~[snakeyaml-1.16.jar:na]
    at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:226) ~[snakeyaml-1.16.jar:na]
    at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingValue.produce(ParserImpl.java:586) ~[snakeyaml-1.16.jar:na]
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158) ~[snakeyaml-1.16.jar:na]
    at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143) ~[snakeyaml-1.16.jar:na]
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:132) ~[snakeyaml-1.16.jar:na]

Most helpful comment

when I use actuactor in spring cloud, need to set some configuration like this:

info:
  app:
  name: '@project.artifactId@'
  java:
    source: '@java.version@'

but in this way,when i enter "localhost:8200/info",it show it's literal meaning liken this:

{
"app": {
"name": "@project.artifactId@",
"java": {
"source": "@java.version@"
}
}
}

in actuator documentation,it should shows like this:

{
"app": {
"name": "microservice",
"java": {
"source": "1.8.0_92"
}
}
}

how did I resolve this problem?

All 4 comments

This is really a yaml usage question. Try with single quotes around the value like secret: '@t3mokz%OQwkM%fOg#P2'

when I use actuactor in spring cloud, need to set some configuration like this:

info:
  app:
  name: '@project.artifactId@'
  java:
    source: '@java.version@'

but in this way,when i enter "localhost:8200/info",it show it's literal meaning liken this:

{
"app": {
"name": "@project.artifactId@",
"java": {
"source": "@java.version@"
}
}
}

in actuator documentation,it should shows like this:

{
"app": {
"name": "microservice",
"java": {
"source": "1.8.0_92"
}
}
}

how did I resolve this problem?

This is not related to Spring Cloud Config. If you have an actuator question than best to ask a question on StackOverflow or the Spring Boot Gitter channel.

it is related to your scan config:
1.check your pom.xml file and make sure the tag <build> is exsit.
2.then point the resource directory to your yml/xml file

Was this page helpful?
0 / 5 - 0 ratings