错误:Attempted to load applicationConfig: [classpath:/application.yml] but snakeyaml was not found on the classpath
MyEclipse导入工程,报错如下:
::42.187 [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:)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadForFileExtension(ConfigFileApplicationListener.java:)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$null$(ConfigFileApplicationListener.java:)
at java.lang.Iterable.forEach(Iterable.java:)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$load$(ConfigFileApplicationListener.java:)
at java.lang.Iterable.forEach(Iterable.java:)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:)
at org.springframework.boot.context.config.ConfigFileApplicationListener.addPropertySources(ConfigFileApplicationListener.java:)
at org.springframework.boot.context.config.ConfigFileApplicationListener.postProcessEnvironment(ConfigFileApplicationListener.java:)
at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.java:)
at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at com.boot.security.server.SecurityApplication.main(SecurityApplication.java:)
Caused by: java.lang.IllegalStateException: Attempted to load applicationConfig: [classpath:/application.yml] but snakeyaml was not found on the classpath
at org.springframework.boot.env.YamlPropertySourceLoader.load(YamlPropertySourceLoader.java:)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadDocuments(ConfigFileApplicationListener.java:)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:)
... common frames omitted
这是因为YML文件解析需要引入的snakeyaml包未找到造成的,解决方式,在pom.xml文件<dependencies></dependencies>元素内添加如下语句:
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.23</version>
</dependency> <dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.2</version>
<type>jar</type>
<exclusions>
<exclusion>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</exclusion>
</exclusions>
</dependency>
错误:Attempted to load applicationConfig: [classpath:/application.yml] but snakeyaml was not found on the classpath的更多相关文章
- Eureka启动报错:Failed to load property source from location 'classpath:/application.yml'
原因: 将application.yml添加到classpath时, 由于变更了application.yml的编码格式(或许也改变了些代码内容), 而target内的yml文件没有实时更新, 从而导 ...
- java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yml'
java.lang.IllegalStateException: Failed to load property source from location 'classpath:/applicatio ...
- Springboot - java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yml'
Caused by: org.yaml.snakeyaml.scanner.ScannerException: while scanning a simple key in 'reader', lin ...
- springboot启动报异常,Failed to load property source from location 'classpath:/application.yml'
学习springboot,在启动时抛出下图异常 往下看异常信息,找到异常的具体位置 找到application.yml文件的对应位置,发现params配置前面多了空格 去掉空格重新启动,可以了 写代码 ...
- VS Code打开使用IDEA搭建的Spring Boot项目运行提示"snakeyaml was not found on the classpath"错误
今天用VS Code打开之前基于IDEA搭建并开发的Spring Boot项目,启动调试后出现如下错误: 17:43:05.214 [restartedMain] ERROR org.springfr ...
- java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application-dev.yml'
如果你的项目没有配置错误,配置文件名称也正常,还出现这个问题,那一定是你的yml文件编码的问题 先附上一张项目架构图 当我启动服务器寻找配置文件的时候,服务器提示这样的错误信息 java.lang.I ...
- SpringCloud入门之常用的配置文件 application.yml和 bootstrap.yml区别
作者其他技术文章 1) Spring Boot 简介 2)SpringCloud入门之YAML格式文件规范学习 3)SpringCloud入门之Spring Boot多环境配置切换指南 4) Elas ...
- SpringBoot启动如何加载application.yml配置文件
一.前言 在spring时代配置文件的加载都是通过web.xml配置加载的(Servlet3.0之前),可能配置方式有所不同,但是大多数都是通过指定路径的文件名的形式去告诉spring该加载哪个文件: ...
- SpringBoot配置(1) 配置文件application&yml
SpringBoot配置(1) 配置文件application&yml 一.配置文件 1.1 配置文件 SpringBoot使用一个全局的配置文件,配置文件名是固定的. application ...
随机推荐
- [Flex] 组件Tree系列 —— 打开和关闭节点
mxm: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:打开和关闭节点--> < ...
- js及Java中对于两个时间日期的判断脚本
JS脚本: function checkDateIsEdited(createDate) { var compareDate = createDate.replace("-",&q ...
- angular4套用primeng样式
首先安装primeng cnpm install primeng --save 这样会在项目目录中增加node_modules\primeng目录 package.json文件增加了以下一行 &quo ...
- ArrayList集合与List与数组的区别
import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.Lis ...
- Log中关于zVideoApp与zChatApp之间的消息传递可以搜索以下字符串
[CSSBConfIPCAgent::OnMessageReceived] (这是zVideoApp端的) 和 [CSSBPTIPCListener::OnMessageReceived] ...
- 启动多个appium服务(同时运行多台设备)
准备: 一台真机一台模拟器(使用的是“夜神模拟器”) 先查看是否检测到设备 adb devices 由上图可看出没有检测到模拟器(夜神模拟器已开启) 可通过以下配置完成: 第一步:找到adb的 ...
- JavaIO流总结
字节流 InputStream FileInputStream FilterInputStream BufferedInputStream DataInputStream PushbackInputS ...
- net与树莓派的情缘-安装Redis(四)
在Linux下安装Redis非常简单,具体步骤如下(官网有说明): .下载源码,解压缩后编译源码. $ wget http://download.redis.io/releases/redis-3.0 ...
- Spring Boot遇到的某些问题
Spring Boot遇到的某些问题 1.关于templates的html包格式问题: <properties> <project.build.sourceEncoding>U ...
- com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote method解决方法
报错日记: Caused by: com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote method: getUserAuthLeve ...