14:38:44.944 [restartedMain] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: Failed to load property source from ‘file:/D:/ideawork/spring-boot-jpa/target/classes/application.yml’ (classpath:/application.yml)
at org.springframework.boot.context.config.ConfigFileApplicationListener L o a d e r . l o a d ( C o n f i g F i l e A p p l i c a t i o n L i s t e n e r . j a v a : 554 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g F i l e A p p l i c a t i o n L i s t e n e r Loader.load(ConfigFileApplicationListener.java:554) at org.springframework.boot.context.config.ConfigFileApplicationListener Loader.load(ConfigFileApplicationListener.java:554)atorg.springframework.boot.context.config.ConfigFileApplicationListenerLoader.loadForFileExtension(ConfigFileApplicationListener.java:499)
at org.springframework.boot.context.config.ConfigFileApplicationListener L o a d e r . l o a d ( C o n f i g F i l e A p p l i c a t i o n L i s t e n e r . j a v a : 469 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g F i l e A p p l i c a t i o n L i s t e n e r Loader.load(ConfigFileApplicationListener.java:469) at org.springframework.boot.context.config.ConfigFileApplicationListener Loader.load(ConfigFileApplicationListener.java:469)atorg.springframework.boot.context.config.ConfigFileApplicationListenerLoader.lambda$null 7 ( C o n f i g F i l e A p p l i c a t i o n L i s t e n e r . j a v a : 448 ) a t j a v a . l a n g . I t e r a b l e . f o r E a c h ( I t e r a b l e . j a v a : 75 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g F i l e A p p l i c a t i o n L i s t e n e r 7(ConfigFileApplicationListener.java:448) at java.lang.Iterable.forEach(Iterable.java:75) at org.springframework.boot.context.config.ConfigFileApplicationListener 7(ConfigFileApplicationListener.java:448)atjava.lang.Iterable.forEach(Iterable.java:75)atorg.springframework.boot.context.config.ConfigFileApplicationListenerLoader.lambda$load 8 ( C o n f i g F i l e A p p l i c a t i o n L i s t e n e r . j a v a : 448 ) a t j a v a . l a n g . I t e r a b l e . f o r E a c h ( I t e r a b l e . j a v a : 75 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g F i l e A p p l i c a t i o n L i s t e n e r 8(ConfigFileApplicationListener.java:448) at java.lang.Iterable.forEach(Iterable.java:75) at org.springframework.boot.context.config.ConfigFileApplicationListener 8(ConfigFileApplicationListener.java:448)atjava.lang.Iterable.forEach(Iterable.java:75)atorg.springframework.boot.context.config.ConfigFileApplicationListenerLoader.load(ConfigFileApplicationListener.java:445)
at org.springframework.boot.context.config.ConfigFileApplicationListener L o a d e r . l a m b d a Loader.lambda Loader.lambdaload 0 ( C o n f i g F i l e A p p l i c a t i o n L i s t e n e r . j a v a : 348 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . F i l t e r e d P r o p e r t y S o u r c e . a p p l y ( F i l t e r e d P r o p e r t y S o u r c e . j a v a : 54 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g F i l e A p p l i c a t i o n L i s t e n e r 0(ConfigFileApplicationListener.java:348) at org.springframework.boot.context.config.FilteredPropertySource.apply(FilteredPropertySource.java:54) at org.springframework.boot.context.config.ConfigFileApplicationListener 0(ConfigFileApplicationListener.java:348)atorg.springframework.boot.context.config.FilteredPropertySource.apply(FilteredPropertySource.java:54)atorg.springframework.boot.context.config.ConfigFileApplicationListenerLoader.load(ConfigFileApplicationListener.java:336)
at org.springframework.boot.context.config.ConfigFileApplicationListener.addPropertySources(ConfigFileApplicationListener.java:226)
at org.springframework.boot.context.config.ConfigFileApplicationListener.postProcessEnvironment(ConfigFileApplicationListener.java:210)
at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.java:200)
at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:188)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:80)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:345)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at com.dqx.study.webapi.SpringBootJpaApplication.main(SpringBootJpaApplication.java:10)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: 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.ensureEnoughData(StreamReader.java:171)
at org.yaml.snakeyaml.reader.StreamReader.peek(StreamReader.java:126)
at org.yaml.snakeyaml.scanner.ScannerImpl.scanToNextToken(ScannerImpl.java:1177)
at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:287)
at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:227)
at org.yaml.snakeyaml.parser.ParserImpl$ParseImplicitDocumentStart.produce(ParserImpl.java:195)
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:148)
at org.yaml.snakeyaml.composer.Composer.checkNode(Composer.java:82)
at org.yaml.snakeyaml.constructor.BaseConstructor.checkData(BaseConstructor.java:123)
at org.yaml.snakeyaml.Yaml 1. h a s N e x t ( Y a m l . j a v a : 489 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . c o n f i g . Y a m l P r o c e s s o r . p r o c e s s ( Y a m l P r o c e s s o r . j a v a : 200 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . c o n f i g . Y a m l P r o c e s s o r . p r o c e s s ( Y a m l P r o c e s s o r . j a v a : 164 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . e n v . O r i g i n T r a c k e d Y a m l L o a d e r . l o a d ( O r i g i n T r a c k e d Y a m l L o a d e r . j a v a : 76 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . e n v . Y a m l P r o p e r t y S o u r c e L o a d e r . l o a d ( Y a m l P r o p e r t y S o u r c e L o a d e r . j a v a : 50 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g F i l e A p p l i c a t i o n L i s t e n e r 1.hasNext(Yaml.java:489) at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:200) at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:164) at org.springframework.boot.env.OriginTrackedYamlLoader.load(OriginTrackedYamlLoader.java:76) at org.springframework.boot.env.YamlPropertySourceLoader.load(YamlPropertySourceLoader.java:50) at org.springframework.boot.context.config.ConfigFileApplicationListener 1.hasNext(Yaml.java:489)atorg.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:200)atorg.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:164)atorg.springframework.boot.env.OriginTrackedYamlLoader.load(OriginTrackedYamlLoader.java:76)atorg.springframework.boot.env.YamlPropertySourceLoader.load(YamlPropertySourceLoader.java:50)atorg.springframework.boot.context.config.ConfigFileApplicationListenerLoader.loadDocuments(ConfigFileApplicationListener.java:608)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:524)
… 30 common frames omitted
Caused by: java.nio.charset.MalformedInputException: Input length = 1
at java.nio.charset.CoderResult.throwException(CoderResult.java:281)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at org.yaml.snakeyaml.reader.UnicodeReader.read(UnicodeReader.java:125)
at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:183)
… 48 common frames omitted
Process finished with exit code 0
可能是由于编码问题导致的
查看项目以及文件的的编码,将所有的统一设置为utf-8编码,然后将application文件复制一份保存,删除项目下的该问价,然后新建,再把配置信息复制粘贴进去
重新启动项目,alright!
不知道为什么,只要一添加校验框架便会出现上述异常
如果删了文件重新新建还是不能启动项目的话,请检查配置文件的正确性,笔者出现这个问题的时候配置文件是完全正确的
如果还不行的话试一下clean一下项目,再重新运行