您好,登錄后才能下訂單哦!
本篇內容主要講解“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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。