本篇内容主要讲解“SpringCloud启动失败问题如何解决”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“SpringCloud启动失败问题如何解决”吧!
org.yaml.snakeyaml.error.YAMLException: java.nio.charset.MalformedInputException: Input length = 1
at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:218) ~[snakeyaml-1.27.jar!/:na]
at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.java:176) ~[snakeyaml-1.27.jar!/:na]
at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.java:171) ~[snakeyaml-1.27.jar!/:na]
at org.yaml.snakeyaml.reader.StreamReader.peek(StreamReader.java:126) ~[snakeyaml-1.27.jar!/:na]
at org.yaml.snakeyaml.scanner.ScannerImpl.scanToNextToken(ScannerImpl.java:1177) ~[snakeyaml-1.27.jar!/:na]
at org.yaml.snakeyaml.constructor.BaseConstructor.checkData(BaseConstructor.java:123) ~[snakeyaml-1.27.jar!/:na]
at org.yaml.snakeyaml.Yaml$1.hasNext(Yaml.java:507) ~[snakeyaml-1.27.jar!/:na]
at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:198) ~[spring-beans-5.3.8.jar!/:5.3.8]
at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:166) ~[spring-beans-5.3.8.jar!/:5.3.8]
at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadNacosPropertySource(NacosPropertySourceLocator.java:199) [spring-cloud-starter-alibaba-nacos-config-2021.1.jar!/:2021.1]
com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadExtConfiguration(NacosPropertySourceLocator.java:128) [spring-cloud-starter-alibaba-nacos-config-2021.1.jar!/:2021.1]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) [app.jar:1.0.0]
Caused by: java.nio.charset.MalformedInputException: Input length = 1
at java.nio.charset.CoderResult.throwException(Unknown Source) ~[na:1.8.0_311]
at sun.nio.cs.StreamDecoder.implRead(Unknown Source) ~[na:1.8.0_311]
at sun.nio.cs.StreamDecoder.read(Unknown Source) ~[na:1.8.0_311]
at java.io.InputStreamReader.read(Unknown Source) ~[na:1.8.0_311]
at org.yaml.snakeyaml.reader.UnicodeReader.read(UnicodeReader.java:125) ~[snakeyaml-1.27.jar!/:na]
at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:183) ~[snakeyaml-1.27.jar!/:na]
... 41 common frames omitted
2022-02-24 15:50:08.897 ERROR 39048 --- [ main] c.a.c.n.c.NacosPropertySourceBuilder : parse data from Nacos error,dataId:dbsource.yml,data:spring:
main:
allow-bean-definition-overriding: true
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
login-username: admin
login-password: admin
reset-enable: false
Root cause:
编码不一致,nacos读取配置文件时默认编码为utf-8,而通过cmd启动项目默认使用gbk。
添加-Dfile.encoding=utf-8 启动参数
java -Dfile.encoding=utf-8 -jar app.jar
到此,相信大家对“SpringCloud启动失败问题如何解决”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。