spring boot 项目, 通过命令: mvn spring-boot:run 启动时, 在读取nacos配置时, 提示报错如下:
c.a.c.n.c.NacosPropertySourceBuilder : parse data from Nacos error,dataId:application-dev.yaml,data:spring:xxx
..... (此处省略nacos配置)
org.yaml.snakeyaml.error.YAMLException: java.nio.charset.MalformedInputException: Input length = 1
at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:218)
at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.java:176)
at org.yaml.snakeyaml.reader.StreamReader.peek(StreamReader.java:136)
解决方案:
方案一: 启动命令时, 通过参数传递 jvm参数
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dfile.encoding=UTF-8"
## -Dspring-boot.run.jvmArguments 可以传递jvm参数,例如内存(-Xms -Xmx)配置等
方案二: 在pom.xml 文件中maven plugin中 增加如下jvm配置:
<plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <jvmArguments>-Dfile.encoding=UTF-8</jvmArguments> </configuration> </plugin> <plugins>
标签:run,spring,boot,yaml,org,StreamReader From: https://www.cnblogs.com/layezi/p/17862354.html