SpringBoot项目突然启动报错:java.lang.IllegalStateException: Failed to load property source from location ‘cl

问题描述

一个demo程序一直用的好好的,写了几个工具类之后,启动测试接口的时候,突然就起不起来了,我以为是我代码的问题,我把新写的代码全部注释,还是不能启动,纳闷了。
先看看错误提示:

15:13:13.629 [main] DEBUG org.springframework.boot.context.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath: [file:/D:/JAVA/JDK8/jre/lib/charsets.jar, file:/D:/JAVA/JDK8/jre/lib/deploy.jar, file:/D:/JAVA/JDK8/jre/lib/ext/access-bridge-64.jar, file:/D:/JAVA/JDK8/jre/lib/ext/cldrdata.jar, file:/D:/JAVA/JDK8/jre/lib/ext/dnsns.jar, file:/D:/JAVA/JDK8/jre/lib/ext/jaccess.jar, file:/D:/JAVA/JDK8/jre/lib/ext/jfxrt.jar, file:/D:/JAVA/JDK8/jre/lib/ext/localedata.jar, file:/D:/JAVA/JDK8/jre/lib/ext/nashorn.jar, file:/D:/JAVA/JDK8/jre/lib/ext/sunec.jar, file:/D:/JAVA/JDK8/jre/lib/ext/sunjce_provider.jar, file:/D:/JAVA/JDK8/jre/lib/ext/sunmscapi.jar, file:/D:/JAVA/JDK8/jre/lib/ext/sunpkcs11.jar, file:/D:/JAVA/JDK8/jre/lib/ext/zipfs.jar, file:/D:/JAVA/JDK8/jre/lib/javaws.jar, file:/D:/JAVA/JDK8/jre/lib/jce.jar, file:/D:/JAVA/JDK8/jre/lib/jfr.jar, file:/D:/JAVA/JDK8/jre/lib/jfxswt.jar, file:/D:/JAVA/JDK8/jre/lib/jsse.jar, file:/D:/JAVA/JDK8/jre/lib/management-agent.jar, file:/D:/JAVA/JDK8/jre/lib/plugin.jar, file:/D:/JAVA/JDK8/jre/lib/resources.jar, file:/D:/JAVA/JDK8/jre/lib/rt.jar, file:/D:/IdeaWorkspace/demo/target/classes/, file:/D:/JAVA/repository/org/springframework/boot/spring-boot-starter-web/2.0.3.RELEASE/spring-boot-starter-web-2.0.3.RELEASE.jar, file:/D:/JAVA/repository/org/springframework/boot/spring-boot-starter/2.0.3.RELEASE/spring-boot-starter-2.0.3.RELEASE.jar, file:/D:/JAVA/repository/org/springframework/boot/spring-boot/2.0.3.RELEASE/spring-boot-2.0.3.RELEASE.jar, file:/D:/JAVA/repository/org/springframework/boot/spring-boot-starter-logging/2.0.3.RELEASE/spring-boot-starter-logging-2.0.3.RELEASE.jar, file:/D:/JAVA/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar, file:/D:/JAVA/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar, file:/D:/JAVA/repository/org/apache/logging/log4j/log4j-to-slf4j/2.10.0/log4j-to-slf4j-2.10.0.jar, file:/D:/JAVA/repository/org/apache/logging/log4j/log4j-api/2.10.0/log4j-api-2.10.0.jar, file:/D:/JAVA/repository/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar, file:/D:/JAVA/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar, file:/D:/JAVA/repository/org/yaml/snakeyaml/1.19/snakeyaml-1.19.jar, file:/D:/JAVA/repository/org/springframework/boot/spring-boot-starter-json/2.0.3.RELEASE/spring-boot-starter-json-2.0.3.RELEASE.jar, file:/D:/JAVA/repository/com/fasterxml/jackson/core/jackson-databind/2.9.6/jackson-databind-2.9.6.jar, file:/D:/JAVA/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar, file:/D:/JAVA/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.6/jackson-datatype-jdk8-2.9.6.jar, file:/D:/JAVA/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.6/jackson-datatype-jsr310-2.9.6.jar, file:/D:/JAVA/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.6/jackson-module-parameter-names-2.9.6.jar, file:/D:/JAVA/repository/org/springframework/boot/spring-boot-starter-tomcat/2.0.3.RELEASE/spring-boot-starter-tomcat-2.0.3.RELEASE.jar, file:/D:/JAVA/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.31/tomcat-embed-core-8.5.31.jar, file:/D:/JAVA/repository/org/apache/tomcat/embed/tomcat-embed-el/8.5.31/tomcat-embed-el-8.5.31.jar, file:/D:/JAVA/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.31/tomcat-embed-websocket-8.5.31.jar, file:/D:/JAVA/repository/org/hibernate/validator/hibernate-validator/6.0.10.Final/hibernate-validator-6.0.10.Final.jar, file:/D:/JAVA/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar, file:/D:/JAVA/repository/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar, file:/D:/JAVA/repository/com/fasterxml/classmate/1.3.4/classmate-1.3.4.jar, file:/D:/JAVA/repository/org/springframework/spring-web/5.0.7.RELEASE/spring-web-5.0.7.RELEASE.jar, file:/D:/JAVA/repository/org/springframework/spring-beans/5.0.7.RELEASE/spring-beans-5.0.7.RELEASE.jar, file:/D:/JAVA/repository/org/springframework/spring-webmvc/5.0.7.RELEASE/spring-webmvc-5.0.7.RELEASE.jar, file:/D:/JAVA/repository/org/springframework/spring-aop/5.0.7.RELEASE/spring-aop-5.0.7.RELEASE.jar, file:/D:/JAVA/repository/org/springframework/spring-context/5.0.7.RELEASE/spring-context-5.0.7.RELEASE.jar, file:/D:/JAVA/repository/org/springframework/spring-expression/5.0.7.RELEASE/spring-expression-5.0.7.RELEASE.jar, file:/D:/JAVA/repository/org/projectlombok/lombok/1.16.22/lombok-1.16.22.jar, file:/D:/JAVA/repository/org/springframework/spring-core/5.0.7.RELEASE/spring-core-5.0.7.RELEASE.jar, file:/D:/JAVA/repository/org/springframework/spring-jcl/5.0.7.RELEASE/spring-jcl-5.0.7.RELEASE.jar, file:/D:/JAVA/repository/com/graphhopper/graphhopper-reader-osm/2.2/graphhopper-reader-osm-2.2.jar, file:/D:/JAVA/repository/org/openstreetmap/osmosis/osmosis-osm-binary/0.47.3/osmosis-osm-binary-0.47.3.jar, file:/D:/JAVA/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar, file:/D:/JAVA/repository/com/graphhopper/graphhopper-core/2.2/graphhopper-core-2.2.jar, file:/D:/JAVA/repository/com/graphhopper/graphhopper-api/2.2/graphhopper-api-2.2.jar, file:/D:/JAVA/repository/org/locationtech/jts/jts-core/1.15.1/jts-core-1.15.1.jar, file:/D:/JAVA/repository/com/carrotsearch/hppc/0.8.1/hppc-0.8.1.jar, file:/D:/JAVA/repository/org/apache/xmlgraphics/xmlgraphics-commons/2.3/xmlgraphics-commons-2.3.jar, file:/D:/JAVA/repository/commons-io/commons-io/1.3.1/commons-io-1.3.1.jar, file:/D:/JAVA/repository/com/graphhopper/directions-api-client-hc/2.2/directions-api-client-hc-2.2.jar, file:/D:/JAVA/repository/com/graphhopper/graphhopper-web-api/2.2/graphhopper-web-api-2.2.jar, file:/D:/JAVA/repository/com/fasterxml/jackson/core/jackson-core/2.9.6/jackson-core-2.9.6.jar, file:/D:/JAVA/repository/com/graphhopper/external/jackson-datatype-jts/0.12-2.5-1/jackson-datatype-jts-0.12-2.5-1.jar, file:/D:/JAVA/repository/com/squareup/okhttp3/okhttp/3.14.2/okhttp-3.14.2.jar, file:/D:/JAVA/repository/com/squareup/okio/okio/1.17.2/okio-1.17.2.jar, file:/D:/JAVA/repository/org/apache/httpcomponents/httpcore/4.4.8/httpcore-4.4.8.jar, file:/D:/JAVA/repository/org/apache/httpcomponents/httpclient/4.5.5/httpclient-4.5.5.jar, file:/D:/JAVA/repository/commons-codec/commons-codec/1.11/commons-codec-1.11.jar, file:/D:/JAVA/repository/com/alibaba/fastjson/1.2.47/fastjson-1.2.47.jar, file:/D:/JAVA/repository/org/gavaghan/geodesy/1.1.3/geodesy-1.1.3.jar, file:/D:/JAVA/repository/mysql/mysql-connector-java/8.0.18/mysql-connector-java-8.0.18.jar, file:/D:/JAVA/repository/com/google/protobuf/protobuf-java/3.6.1/protobuf-java-3.6.1.jar, file:/D:/JAVA/repository/org/apache/ant/ant/1.9.3/ant-1.9.3.jar, file:/D:/JAVA/repository/org/apache/ant/ant-launcher/1.9.3/ant-launcher-1.9.3.jar, file:/D:/JAVA/repository/org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.jar, file:/D:/JAVA/repository/cn/hutool/hutool-all/5.4.5/hutool-all-5.4.5.jar, file:/D:/JAVA/repository/com/baomidou/mybatis-plus-boot-starter/3.3.1/mybatis-plus-boot-starter-3.3.1.jar, file:/D:/JAVA/repository/com/baomidou/mybatis-plus/3.3.1/mybatis-plus-3.3.1.jar, file:/D:/JAVA/repository/org/springframework/boot/spring-boot-autoconfigure/2.0.3.RELEASE/spring-boot-autoconfigure-2.0.3.RELEASE.jar, file:/D:/JAVA/repository/org/springframework/boot/spring-boot-starter-jdbc/2.0.3.RELEASE/spring-boot-starter-jdbc-2.0.3.RELEASE.jar, file:/D:/JAVA/repository/com/zaxxer/HikariCP/2.7.9/HikariCP-2.7.9.jar, file:/D:/JAVA/repository/org/springframework/spring-jdbc/5.0.7.RELEASE/spring-jdbc-5.0.7.RELEASE.jar, file:/D:/JAVA/repository/org/springframework/spring-tx/5.0.7.RELEASE/spring-tx-5.0.7.RELEASE.jar, file:/D:/JAVA/repository/com/baomidou/mybatis-plus-generator/3.3.1.tmp/mybatis-plus-generator-3.3.1.tmp.jar, file:/D:/JAVA/repository/com/baomidou/mybatis-plus-extension/3.3.1.tmp/mybatis-plus-extension-3.3.1.tmp.jar, file:/D:/JAVA/repository/com/baomidou/mybatis-plus-core/3.3.1.tmp/mybatis-plus-core-3.3.1.tmp.jar, file:/D:/JAVA/repository/com/baomidou/mybatis-plus-annotation/3.3.1.tmp/mybatis-plus-annotation-3.3.1.tmp.jar, file:/D:/JAVA/repository/com/github/jsqlparser/jsqlparser/3.1/jsqlparser-3.1.jar, file:/D:/JAVA/repository/org/mybatis/mybatis/3.5.3/mybatis-3.5.3.jar, file:/D:/JAVA/repository/org/mybatis/mybatis-spring/2.0.3/mybatis-spring-2.0.3.jar, file:/D:/JAVA/repository/org/apache/velocity/velocity-engine-core/2.2/velocity-engine-core-2.2.jar, file:/D:/software/IntelliJ%20IDEA/lib/idea_rt.jar]
15:13:13.639 [background-preinit] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Log4j2LoggerProvider
15:13:13.640 [background-preinit] INFO org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 6.0.10.Final
15:13:13.644 [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.
15:13:13.646 [background-preinit] DEBUG org.hibernate.validator.internal.xml.ValidationXmlParser - Trying to load META-INF/validation.xml for XML based Validator configuration.
15:13:13.647 [background-preinit] DEBUG org.hibernate.validator.internal.xml.ResourceLoaderHelper - Trying to load META-INF/validation.xml via TCCL
15:13:13.647 [background-preinit] DEBUG org.hibernate.validator.internal.xml.ResourceLoaderHelper - Trying to load META-INF/validation.xml via Hibernate Validator's class loader
15:13:13.647 [background-preinit] DEBUG org.hibernate.validator.internal.xml.ValidationXmlParser - No META-INF/validation.xml found. Using annotation based configuration only.
15:13:13.727 [background-preinit] DEBUG org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator - Loaded expression factory via original TCCL
15:13:13.731 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator as ValidatorFactory-scoped message interpolator.
15:13:13.731 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.resolver.TraverseAllTraversableResolver as ValidatorFactory-scoped traversable resolver.
15:13:13.731 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.util.ExecutableParameterNameProvider as ValidatorFactory-scoped parameter name provider.
15:13:13.731 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.DefaultClockProvider as ValidatorFactory-scoped clock provider.
15:13:13.731 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.scripting.DefaultScriptEvaluatorFactory as ValidatorFactory-scoped script evaluator factory.
15:13:14.002 [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:538)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadForFileExtension(ConfigFileApplicationListener.java:497)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:465)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$null$6(ConfigFileApplicationListener.java:447)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$load$7(ConfigFileApplicationListener.java:446)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:443)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:335)
	at org.springframework.boot.context.config.ConfigFileApplicationListener.addPropertySources(ConfigFileApplicationListener.java:214)
	at org.springframework.boot.context.config.ConfigFileApplicationListener.postProcessEnvironment(ConfigFileApplicationListener.java:197)
	at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.java:184)
	at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:170)
	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.map.demo.DemoApplication.main(DemoApplication.java:13)
Caused by: org.yaml.snakeyaml.error.YAMLException: java.nio.charset.MalformedInputException: Input length = 1
	at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:254)
	at org.yaml.snakeyaml.reader.StreamReader.<init>(StreamReader.java:58)
	at org.yaml.snakeyaml.Yaml.loadAll(Yaml.java:537)
	at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:166)
	at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:139)
	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:556)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:518)
	... 23 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:223)
	... 31 common frames omitted

Process finished with exit code 1

很明显看出是yml文件有问题,但是我没有修改过这个配置文件,并且检查空格以及其他的格式,都没有问题,那应该是其他原因造成。

解决方法

害,最后发现是target中的yml文件编码格式的有问题,把yml文件中文注释删掉,或者修改一下yml的文件编码,就好了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值