java工程yml配置文件_项目启动报错,找不到配置文件application.yml

在使用renren-security版本的Java工程中,开发者遇到项目启动报错,问题指向无法找到/classpath:/application.yml配置文件。尝试修改数据库连接账号密码后,错误依旧,报错信息包括SLF4J绑定失败及IllegalStateException,提示snakeyaml库未在类路径中找到。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

项目启动报错,找不到配置文件application.yml

提问

未结

1

 1078

721ae9220bec252c3c61820cc49aee72.png

程会玩

2019-09-20

悬赏:20积分

版本:renren-security

开发环境:

项目跑不起来,说是找不到/application.yml的配置文件,我项目下载下来只改了数据库连接的账号密码

报错如下:

Connected to the target VM, address: '127.0.0.1:64537', transport: 'socket'

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

SLF4J: Defaulting to no-operation (NOP) logger implementation

SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Disconnected from the target VM, address: '127.0.0.1:64537', transport: 'socket'

Exception in thread "main" java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yml'

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

at io.renren.GeneratorApplication.main(GeneratorApplication.java:18)

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

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

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

... 23 more

Process finished with exit code 1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值