为了账号安全,请及时绑定邮箱和手机立即绑定

不知道为什么报IllegalStateException:未能从“classpath:/application.yml”位置加载属性源。

D:\JDK1.8\bin\java -Dspring.output.ansi.enabled=always -Didea.launcher.port=7537 "-Didea.launcher.bin.path=D:\IDEA\IntelliJ IDEA 2016.1.4\bin" -Dfile.encoding=UTF-8 -classpath "D:\JDK1.8\jre\lib\charsets.jar;D:\JDK1.8\jre\lib\deploy.jar;D:\JDK1.8\jre\lib\ext\access-bridge-64.jar;D:\JDK1.8\jre\lib\ext\cldrdata.jar;D:\JDK1.8\jre\lib\ext\dnsns.jar;D:\JDK1.8\jre\lib\ext\jaccess.jar;D:\JDK1.8\jre\lib\ext\jfxrt.jar;D:\JDK1.8\jre\lib\ext\localedata.jar;D:\JDK1.8\jre\lib\ext\nashorn.jar;D:\JDK1.8\jre\lib\ext\sunec.jar;D:\JDK1.8\jre\lib\ext\sunjce_provider.jar;D:\JDK1.8\jre\lib\ext\sunmscapi.jar;D:\JDK1.8\jre\lib\ext\sunpkcs11.jar;D:\JDK1.8\jre\lib\ext\zipfs.jar;D:\JDK1.8\jre\lib\javaws.jar;D:\JDK1.8\jre\lib\jce.jar;D:\JDK1.8\jre\lib\jfr.jar;D:\JDK1.8\jre\lib\jfxswt.jar;D:\JDK1.8\jre\lib\jsse.jar;D:\JDK1.8\jre\lib\management-agent.jar;D:\JDK1.8\jre\lib\plugin.jar;D:\JDK1.8\jre\lib\resources.jar;D:\JDK1.8\jre\lib\rt.jar;D:\IDEA\Documents\dev\java\imooc\gril\target\classes;C:\Users\ZJ\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.0.2.RELEASE\spring-boot-starter-web-2.0.2.RELEASE.jar;C:\Users\ZJ\.m2\repository\org\springframework\boot\spring-boot-starter\2.0.2.RELEASE\spring-boot-starter-2.0.2.RELEASE.jar;C:\Users\ZJ\.m2\repository\org\springframework\boot\spring-boot\2.0.2.RELEASE\spring-boot-2.0.2.RELEASE.jar;C:\Users\ZJ\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.0.2.RELEASE\spring-boot-autoconfigure-2.0.2.RELEASE.jar;C:\Users\ZJ\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.0.2.RELEASE\spring-boot-starter-logging-2.0.2.RELEASE.jar;C:\Users\ZJ\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\ZJ\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\ZJ\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.10.0\log4j-to-slf4j-2.10.0.jar;C:\Users\ZJ\.m2\repository\org\apache\logging\log4j\log4j-api\2.10.0\log4j-api-2.10.0.jar;C:\Users\ZJ\.m2\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;C:\Users\ZJ\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;C:\Users\ZJ\.m2\repository\org\yaml\snakeyaml\1.19\snakeyaml-1.19.jar;C:\Users\ZJ\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.0.2.RELEASE\spring-boot-starter-json-2.0.2.RELEASE.jar;C:\Users\ZJ\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.5\jackson-databind-2.9.5.jar;C:\Users\ZJ\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;C:\Users\ZJ\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.9.5\jackson-core-2.9.5.jar;C:\Users\ZJ\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.5\jackson-datatype-jdk8-2.9.5.jar;C:\Users\ZJ\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.5\jackson-datatype-jsr310-2.9.5.jar;C:\Users\ZJ\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.5\jackson-module-parameter-names-2.9.5.jar;C:\Users\ZJ\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.0.2.RELEASE\spring-boot-starter-tomcat-2.0.2.RELEASE.jar;C:\Users\ZJ\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.31\tomcat-embed-core-8.5.31.jar;C:\Users\ZJ\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.31\tomcat-embed-el-8.5.31.jar;C:\Users\ZJ\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.31\tomcat-embed-websocket-8.5.31.jar;C:\Users\ZJ\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.9.Final\hibernate-validator-6.0.9.Final.jar;C:\Users\ZJ\.m2\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;C:\Users\ZJ\.m2\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;C:\Users\ZJ\.m2\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;C:\Users\ZJ\.m2\repository\org\springframework\spring-web\5.0.6.RELEASE\spring-web-5.0.6.RELEASE.jar;C:\Users\ZJ\.m2\repository\org\springframework\spring-beans\5.0.6.RELEASE\spring-beans-5.0.6.RELEASE.jar;C:\Users\ZJ\.m2\repository\org\springframework\spring-webmvc\5.0.6.RELEASE\spring-webmvc-5.0.6.RELEASE.jar;C:\Users\ZJ\.m2\repository\org\springframework\spring-aop\5.0.6.RELEASE\spring-aop-5.0.6.RELEASE.jar;C:\Users\ZJ\.m2\repository\org\springframework\spring-context\5.0.6.RELEASE\spring-context-5.0.6.RELEASE.jar;C:\Users\ZJ\.m2\repository\org\springframework\spring-expression\5.0.6.RELEASE\spring-expression-5.0.6.RELEASE.jar;C:\Users\ZJ\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\ZJ\.m2\repository\org\springframework\spring-core\5.0.6.RELEASE\spring-core-5.0.6.RELEASE.jar;C:\Users\ZJ\.m2\repository\org\springframework\spring-jcl\5.0.6.RELEASE\spring-jcl-5.0.6.RELEASE.jar;D:\IDEA\IntelliJ IDEA 2016.1.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.imooc.GrilApplication

10:42:30.000 [main] DEBUG org.springframework.boot.context.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath: [file:/D:/JDK1.8/jre/lib/charsets.jar, file:/D:/JDK1.8/jre/lib/deploy.jar, file:/D:/JDK1.8/jre/lib/ext/access-bridge-64.jar, file:/D:/JDK1.8/jre/lib/ext/cldrdata.jar, file:/D:/JDK1.8/jre/lib/ext/dnsns.jar, file:/D:/JDK1.8/jre/lib/ext/jaccess.jar, file:/D:/JDK1.8/jre/lib/ext/jfxrt.jar, file:/D:/JDK1.8/jre/lib/ext/localedata.jar, file:/D:/JDK1.8/jre/lib/ext/nashorn.jar, file:/D:/JDK1.8/jre/lib/ext/sunec.jar, file:/D:/JDK1.8/jre/lib/ext/sunjce_provider.jar, file:/D:/JDK1.8/jre/lib/ext/sunmscapi.jar, file:/D:/JDK1.8/jre/lib/ext/sunpkcs11.jar, file:/D:/JDK1.8/jre/lib/ext/zipfs.jar, file:/D:/JDK1.8/jre/lib/javaws.jar, file:/D:/JDK1.8/jre/lib/jce.jar, file:/D:/JDK1.8/jre/lib/jfr.jar, file:/D:/JDK1.8/jre/lib/jfxswt.jar, file:/D:/JDK1.8/jre/lib/jsse.jar, file:/D:/JDK1.8/jre/lib/management-agent.jar, file:/D:/JDK1.8/jre/lib/plugin.jar, file:/D:/JDK1.8/jre/lib/resources.jar, file:/D:/JDK1.8/jre/lib/rt.jar, file:/D:/IDEA/Documents/dev/java/imooc/gril/target/classes/, file:/C:/Users/ZJ/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.0.2.RELEASE/spring-boot-starter-web-2.0.2.RELEASE.jar, file:/C:/Users/ZJ/.m2/repository/org/springframework/boot/spring-boot-starter/2.0.2.RELEASE/spring-boot-starter-2.0.2.RELEASE.jar, file:/C:/Users/ZJ/.m2/repository/org/springframework/boot/spring-boot/2.0.2.RELEASE/spring-boot-2.0.2.RELEASE.jar, file:/C:/Users/ZJ/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.0.2.RELEASE/spring-boot-autoconfigure-2.0.2.RELEASE.jar, file:/C:/Users/ZJ/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.0.2.RELEASE/spring-boot-starter-logging-2.0.2.RELEASE.jar, file:/C:/Users/ZJ/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar, file:/C:/Users/ZJ/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar, file:/C:/Users/ZJ/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.10.0/log4j-to-slf4j-2.10.0.jar, file:/C:/Users/ZJ/.m2/repository/org/apache/logging/log4j/log4j-api/2.10.0/log4j-api-2.10.0.jar, file:/C:/Users/ZJ/.m2/repository/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar, file:/C:/Users/ZJ/.m2/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar, file:/C:/Users/ZJ/.m2/repository/org/yaml/snakeyaml/1.19/snakeyaml-1.19.jar, file:/C:/Users/ZJ/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.0.2.RELEASE/spring-boot-starter-json-2.0.2.RELEASE.jar, file:/C:/Users/ZJ/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.5/jackson-databind-2.9.5.jar, file:/C:/Users/ZJ/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar, file:/C:/Users/ZJ/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.5/jackson-core-2.9.5.jar, file:/C:/Users/ZJ/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.5/jackson-datatype-jdk8-2.9.5.jar, file:/C:/Users/ZJ/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.5/jackson-datatype-jsr310-2.9.5.jar, file:/C:/Users/ZJ/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.5/jackson-module-parameter-names-2.9.5.jar, file:/C:/Users/ZJ/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.0.2.RELEASE/spring-boot-starter-tomcat-2.0.2.RELEASE.jar, file:/C:/Users/ZJ/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.31/tomcat-embed-core-8.5.31.jar, file:/C:/Users/ZJ/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.5.31/tomcat-embed-el-8.5.31.jar, file:/C:/Users/ZJ/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.31/tomcat-embed-websocket-8.5.31.jar, file:/C:/Users/ZJ/.m2/repository/org/hibernate/validator/hibernate-validator/6.0.9.Final/hibernate-validator-6.0.9.Final.jar, file:/C:/Users/ZJ/.m2/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar, file:/C:/Users/ZJ/.m2/repository/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar, file:/C:/Users/ZJ/.m2/repository/com/fasterxml/classmate/1.3.4/classmate-1.3.4.jar, file:/C:/Users/ZJ/.m2/repository/org/springframework/spring-web/5.0.6.RELEASE/spring-web-5.0.6.RELEASE.jar, file:/C:/Users/ZJ/.m2/repository/org/springframework/spring-beans/5.0.6.RELEASE/spring-beans-5.0.6.RELEASE.jar, file:/C:/Users/ZJ/.m2/repository/org/springframework/spring-webmvc/5.0.6.RELEASE/spring-webmvc-5.0.6.RELEASE.jar, file:/C:/Users/ZJ/.m2/repository/org/springframework/spring-aop/5.0.6.RELEASE/spring-aop-5.0.6.RELEASE.jar, file:/C:/Users/ZJ/.m2/repository/org/springframework/spring-context/5.0.6.RELEASE/spring-context-5.0.6.RELEASE.jar, file:/C:/Users/ZJ/.m2/repository/org/springframework/spring-expression/5.0.6.RELEASE/spring-expression-5.0.6.RELEASE.jar, file:/C:/Users/ZJ/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar, file:/C:/Users/ZJ/.m2/repository/org/springframework/spring-core/5.0.6.RELEASE/spring-core-5.0.6.RELEASE.jar, file:/C:/Users/ZJ/.m2/repository/org/springframework/spring-jcl/5.0.6.RELEASE/spring-jcl-5.0.6.RELEASE.jar, file:/D:/IDEA/IntelliJ%20IDEA%202016.1.4/lib/idea_rt.jar]

10:42:30.111 [background-preinit] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Log4j2LoggerProvider

10:42:30.113 [background-preinit] INFO org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 6.0.9.Final

10:42:30.197 [background-preinit] DEBUG org.hibernate.validator.internal.engine.resolver.TraversableResolvers - Cannot find javax.persistence.Persistence on classpath. Assuming non JPA 2 environment. All properties will per default be traversable.

10:42:30.349 [background-preinit] DEBUG org.hibernate.validator.internal.xml.ValidationXmlParser - Trying to load META-INF/validation.xml for XML based Validator configuration.

10:42:30.386 [background-preinit] DEBUG org.hibernate.validator.internal.xml.ResourceLoaderHelper - Trying to load META-INF/validation.xml via TCCL

10:42:30.387 [background-preinit] DEBUG org.hibernate.validator.internal.xml.ResourceLoaderHelper - Trying to load META-INF/validation.xml via Hibernate Validator's class loader

10:42:30.388 [background-preinit] DEBUG org.hibernate.validator.internal.xml.ValidationXmlParser - No META-INF/validation.xml found. Using annotation based configuration only.

10:42:32.925 [background-preinit] DEBUG org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator - Loaded expression factory via original TCCL

10:42:33.031 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator as ValidatorFactory-scoped message interpolator.

10:42:33.032 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.resolver.TraverseAllTraversableResolver as ValidatorFactory-scoped traversable resolver.

10:42:33.032 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.util.ExecutableParameterNameProvider as ValidatorFactory-scoped parameter name provider.

10:42:33.032 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.DefaultClockProvider as ValidatorFactory-scoped clock provider.

10:42:33.033 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.scripting.DefaultScriptEvaluatorFactory as ValidatorFactory-scoped script evaluator factory.

10:42:40.788 [main] ERROR org.springframework.boot.SpringApplication - Application run failed

java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yml'

at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:537)

at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadForFileExtension(ConfigFileApplicationListener.java:496)

at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:464)

at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$null$6(ConfigFileApplicationListener.java:446)

at java.lang.Iterable.forEach(Iterable.java:75)

at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$load$7(ConfigFileApplicationListener.java:445)

at java.lang.Iterable.forEach(Iterable.java:75)

at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:442)

at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:330)

at org.springframework.boot.context.config.ConfigFileApplicationListener.addPropertySources(ConfigFileApplicationListener.java:212)

at org.springframework.boot.context.config.ConfigFileApplicationListener.postProcessEnvironment(ConfigFileApplicationListener.java:195)

at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.java:182)

at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:168)

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:74)

at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)

at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:358)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:317)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)

at com.imooc.GrilApplication.main(GrilApplication.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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

Caused by: org.yaml.snakeyaml.scanner.ScannerException: while scanning a simple key

 in 'reader', line 3, column 3:

      cupSize:B

      ^

could not find expected ':'

 in 'reader', line 3, column 12:

    cupSize:B

             ^


at org.yaml.snakeyaml.scanner.ScannerImpl.removePossibleSimpleKey(ScannerImpl.java:515)

at org.yaml.snakeyaml.scanner.ScannerImpl.fetchStreamEnd(ScannerImpl.java:588)

at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:301)

at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:226)

at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:557)

at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:157)

at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:147)

at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:227)

at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:154)

at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:249)

at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:240)

at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:228)

at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:154)

at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:122)

at org.yaml.snakeyaml.composer.Composer.getNode(Composer.java:84)

at org.yaml.snakeyaml.constructor.BaseConstructor.getData(BaseConstructor.java:123)

at org.yaml.snakeyaml.Yaml$1.next(Yaml.java:547)

at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:168)

at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:141)

at org.springframework.boot.env.OriginTrackedYamlLoader.load(OriginTrackedYamlLoader.java:75)

at org.springframework.boot.env.YamlPropertySourceLoader.load(YamlPropertySourceLoader.java:50)

at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadDocuments(ConfigFileApplicationListener.java:547)

at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:517)

... 28 common frames omitted


Process finished with exit code 1


正在回答

1 回答

已解决,就是yml文件缩进问题

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
2小时学会Spring Boot
  • 参与学习       151586    人
  • 解答问题       1079    个

Spring Boot入门视频教程,你将学会使用Spring Boot快速构建应用程序

进入课程

不知道为什么报IllegalStateException:未能从“classpath:/application.yml”位置加载属性源。

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信