Unable to load config data resource from pattern ‘file:./config/*/application.yaml‘ 解决方法

部署宝兰德发现的问题,升级springboot版本,我的版本是2.5.2,升级到2.5.6就好了

java.lang.IllegalStateException: Unable to load config data resource from pattern ‘file:./config/*/application.yaml’
at org.springframework.boot.context.config.LocationResourceLoader.getDirectory(LocationResourceLoader.java:141) ~[spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.context.config.LocationResourceLoader.getResources(LocationResourceLoader.java:102) ~[spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.context.config.StandardConfigDataLocationResolver.resolvePattern(StandardConfigDataLocationResolver.java:309) ~[spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.context.config.StandardConfigDataLocationResolver.resolve(StandardConfigDataLocationResolver.java:295) ~[spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.context.config.StandardConfigDataLocationResolver.resolve(StandardConfigDataLocationResolver.java:249) ~[spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.context.config.StandardConfigDataLocationResolver.resolve(StandardConfigDataLocationResolver.java:119) ~[spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.context.config.ConfigDataLocationResolvers.lambda$resolve 1 ( C o n f i g D a t a L o c a t i o n R e s o l v e r s . j a v a : 115 )   [ s p r i n g − b o o t − 2.5.2. j a r : 2.5.2 ] 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 D a t a L o c a t i o n R e s o l v e r s . r e s o l v e ( C o n f i g D a t a L o c a t i o n R e s o l v e r s . j a v a : 126 )   [ s p r i n g − b o o t − 2.5.2. j a r : 2.5.2 ] 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 D a t a L o c a t i o n R e s o l v e r s . r e s o l v e ( C o n f i g D a t a L o c a t i o n R e s o l v e r s . j a v a : 115 )   [ s p r i n g − b o o t − 2.5.2. j a r : 2.5.2 ] 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 D a t a L o c a t i o n R e s o l v e r s . r e s o l v e ( C o n f i g D a t a L o c a t i o n R e s o l v e r s . j a v a : 107 )   [ s p r i n g − b o o t − 2.5.2. j a r : 2.5.2 ] 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 D a t a I m p o r t e r . r e s o l v e ( C o n f i g D a t a I m p o r t e r . j a v a : 105 )   [ s p r i n g − b o o t − 2.5.2. j a r : 2.5.2 ] 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 D a t a I m p o r t e r . r e s o l v e ( C o n f i g D a t a I m p o r t e r . j a v a : 97 )   [ s p r i n g − b o o t − 2.5.2. j a r : 2.5.2 ] 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 D a t a I m p o r t e r . r e s o l v e A n d L o a d ( C o n f i g D a t a I m p o r t e r . j a v a : 85 )   [ s p r i n g − b o o t − 2.5.2. j a r : 2.5.2 ] 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 D a t a E n v i r o n m e n t C o n t r i b u t o r s . w i t h P r o c e s s e d I m p o r t s ( C o n f i g D a t a E n v i r o n m e n t C o n t r i b u t o r s . j a v a : 121 )   [ s p r i n g − b o o t − 2.5.2. j a r : 2.5.2 ] 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 D a t a E n v i r o n m e n t . p r o c e s s I n i t i a l ( C o n f i g D a t a E n v i r o n m e n t . j a v a : 240 )   [ s p r i n g − b o o t − 2.5.2. j a r : 2.5.2 ] 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 D a t a E n v i r o n m e n t . p r o c e s s A n d A p p l y ( C o n f i g D a t a E n v i r o n m e n t . j a v a : 227 )   [ s p r i n g − b o o t − 2.5.2. j a r : 2.5.2 ] 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 D a t a E n v i r o n m e n t P o s t P r o c e s s o r . p o s t P r o c e s s E n v i r o n m e n t ( C o n f i g D a t a E n v i r o n m e n t P o s t P r o c e s s o r . j a v a : 102 )   [ s p r i n g − b o o t − 2.5.2. j a r : 2.5.2 ] 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 D a t a E n v i r o n m e n t P o s t P r o c e s s o r . p o s t P r o c e s s E n v i r o n m e n t ( C o n f i g D a t a E n v i r o n m e n t P o s t P r o c e s s o r . j a v a : 94 )   [ s p r i n g − b o o t − 2.5.2. j a r : 2.5.2 ] 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 . E n v i r o n m e n t P o s t P r o c e s s o r A p p l i c a t i o n L i s t e n e r . o n A p p l i c a t i o n E n v i r o n m e n t P r e p a r e d E v e n t ( E n v i r o n m e n t P o s t P r o c e s s o r A p p l i c a t i o n L i s t e n e r . j a v a : 102 )   [ s p r i n g − b o o t − 2.5.2. j a r : 2.5.2 ] 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 . E n v i r o n m e n t P o s t P r o c e s s o r A p p l i c a t i o n L i s t e n e r . o n A p p l i c a t i o n E v e n t ( E n v i r o n m e n t P o s t P r o c e s s o r A p p l i c a t i o n L i s t e n e r . j a v a : 87 )   [ s p r i n g − b o o t − 2.5.2. j a r : 2.5.2 ] a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . e v e n t . S i m p l e A p p l i c a t i o n E v e n t M u l t i c a s t e r . d o I n v o k e L i s t e n e r ( S i m p l e A p p l i c a t i o n E v e n t M u l t i c a s t e r . j a v a : 176 )   [ s p r i n g − c o n t e x t − 5.3.8. j a r : 5.3.8 ] a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . e v e n t . S i m p l e A p p l i c a t i o n E v e n t M u l t i c a s t e r . i n v o k e L i s t e n e r ( S i m p l e A p p l i c a t i o n E v e n t M u l t i c a s t e r . j a v a : 169 )   [ s p r i n g − c o n t e x t − 5.3.8. j a r : 5.3.8 ] a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . e v e n t . S i m p l e A p p l i c a t i o n E v e n t M u l t i c a s t e r . m u l t i c a s t E v e n t ( S i m p l e A p p l i c a t i o n E v e n t M u l t i c a s t e r . j a v a : 143 )   [ s p r i n g − c o n t e x t − 5.3.8. j a r : 5.3.8 ] a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . e v e n t . S i m p l e A p p l i c a t i o n E v e n t M u l t i c a s t e r . m u l t i c a s t E v e n t ( S i m p l e A p p l i c a t i o n E v e n t M u l t i c a s t e r . j a v a : 131 )   [ s p r i n g − c o n t e x t − 5.3.8. j a r : 5.3.8 ] 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 . e v e n t . E v e n t P u b l i s h i n g R u n L i s t e n e r . e n v i r o n m e n t P r e p a r e d ( E v e n t P u b l i s h i n g R u n L i s t e n e r . j a v a : 82 )   [ s p r i n g − b o o t − 2.5.2. j a r : 2.5.2 ] a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n R u n L i s t e n e r s . l a m b d a 1(ConfigDataLocationResolvers.java:115) ~[spring-boot-2.5.2.jar:2.5.2] at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:126) ~[spring-boot-2.5.2.jar:2.5.2] at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:115) ~[spring-boot-2.5.2.jar:2.5.2] at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:107) ~[spring-boot-2.5.2.jar:2.5.2] at org.springframework.boot.context.config.ConfigDataImporter.resolve(ConfigDataImporter.java:105) ~[spring-boot-2.5.2.jar:2.5.2] at org.springframework.boot.context.config.ConfigDataImporter.resolve(ConfigDataImporter.java:97) ~[spring-boot-2.5.2.jar:2.5.2] at org.springframework.boot.context.config.ConfigDataImporter.resolveAndLoad(ConfigDataImporter.java:85) ~[spring-boot-2.5.2.jar:2.5.2] at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.withProcessedImports(ConfigDataEnvironmentContributors.java:121) ~[spring-boot-2.5.2.jar:2.5.2] at org.springframework.boot.context.config.ConfigDataEnvironment.processInitial(ConfigDataEnvironment.java:240) ~[spring-boot-2.5.2.jar:2.5.2] at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:227) ~[spring-boot-2.5.2.jar:2.5.2] at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:102) ~[spring-boot-2.5.2.jar:2.5.2] at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:94) ~[spring-boot-2.5.2.jar:2.5.2] at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:102) ~[spring-boot-2.5.2.jar:2.5.2] at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:87) ~[spring-boot-2.5.2.jar:2.5.2] at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.8.jar:5.3.8] at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.8.jar:5.3.8] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.8.jar:5.3.8] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131) ~[spring-context-5.3.8.jar:5.3.8] at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82) ~[spring-boot-2.5.2.jar:2.5.2] at org.springframework.boot.SpringApplicationRunListeners.lambda 1(ConfigDataLocationResolvers.java:115) [springboot2.5.2.jar:2.5.2]atorg.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:126) [springboot2.5.2.jar:2.5.2]atorg.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:115) [springboot2.5.2.jar:2.5.2]atorg.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:107) [springboot2.5.2.jar:2.5.2]atorg.springframework.boot.context.config.ConfigDataImporter.resolve(ConfigDataImporter.java:105) [springboot2.5.2.jar:2.5.2]atorg.springframework.boot.context.config.ConfigDataImporter.resolve(ConfigDataImporter.java:97) [springboot2.5.2.jar:2.5.2]atorg.springframework.boot.context.config.ConfigDataImporter.resolveAndLoad(ConfigDataImporter.java:85) [springboot2.5.2.jar:2.5.2]atorg.springframework.boot.context.config.ConfigDataEnvironmentContributors.withProcessedImports(ConfigDataEnvironmentContributors.java:121) [springboot2.5.2.jar:2.5.2]atorg.springframework.boot.context.config.ConfigDataEnvironment.processInitial(ConfigDataEnvironment.java:240) [springboot2.5.2.jar:2.5.2]atorg.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:227) [springboot2.5.2.jar:2.5.2]atorg.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:102) [springboot2.5.2.jar:2.5.2]atorg.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:94) [springboot2.5.2.jar:2.5.2]atorg.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:102) [springboot2.5.2.jar:2.5.2]atorg.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:87) [springboot2.5.2.jar:2.5.2]atorg.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) [springcontext5.3.8.jar:5.3.8]atorg.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) [springcontext5.3.8.jar:5.3.8]atorg.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) [springcontext5.3.8.jar:5.3.8]atorg.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131) [springcontext5.3.8.jar:5.3.8]atorg.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82) [springboot2.5.2.jar:2.5.2]atorg.springframework.boot.SpringApplicationRunListeners.lambdaenvironmentPrepared$2(SpringApplicationRunListeners.java:63) ~[spring-boot-2.5.2.jar:2.5.2]
at java.util.ArrayList.forEach(ArrayList.java:1257) ~[?:1.8.0_241]
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117) ~[spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111) ~[spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62) ~[spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:374) [spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:332) [spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:175) [spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:155) [spring-boot-2.5.2.jar:2.5.2]
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:97) [spring-boot-2.5.2.jar:2.5.2]
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174) [spring-web-5.3.8.jar:5.3.8]
at com.bes.enterprise.webtier.core.DefaultContext.startInternal(DefaultContext.java:5162) [bes-engine.jar:9.5.x]
at com.bes.enterprise.webtier.util.LifecycleBase.start(LifecycleBase.java:182) [bes-engine.jar:9.5.x]
at com.bes.enterprise.webtier.core.ContainerBase.addChildInternal(ContainerBase.java:741) [bes-engine.jar:9.5.x]
at com.bes.enterprise.webtier.core.ContainerBase.addChild(ContainerBase.java:717) [bes-engine.jar:9.5.x]
at com.bes.enterprise.webtier.core.DefaultHost.addChild(DefaultHost.java:711) [bes-engine.jar:9.5.x]
at com.bes.enterprise.webext.BESWebAppBuilder.deployWebApps(BESWebAppBuilder.java:507) [bes-ee-integration.jar:9.5.2]
at com.bes.enterprise.ejb.assembler.classic.assemblercontext.ApplicationDeployer.deployWebApps(ApplicationDeployer.java:1440) [bes-server-core.jar:9.5.2]
at com.bes.enterprise.ejb.assembler.classic.assemblercontext.ApplicationDeployer.doCreateApplication(ApplicationDeployer.java:427) [bes-server-core.jar:9.5.2]
at com.bes.enterprise.ejb.assembler.classic.assemblercontext.ApplicationDeployer.createApplication(ApplicationDeployer.java:332) [bes-server-core.jar:9.5.2]

  • 23
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要读取上述YAML文件,可以使用适合的YAML解析库,例如YAML-CPP或YAMLCPP-Parser。以下是使用YAML-CPP的示例代码: ```cpp #include <iostream> #include <yaml-cpp/yaml.h> void readConfig(const YAML::Node& config) { if (config["general"]) { // 读取general字段的值 YAML::Node general = config["general"]; if (general["use_ros"]) { bool useRos = general["use_ros"].as<bool>(); std::cout << "use_ros: " << std::boolalpha << useRos << std::endl; } if (general["use_proto"]) { bool useProto = general["use_proto"].as<bool>(); std::cout << "use_proto: " << std::boolalpha << useProto << std::endl; } } if (config["sensor"]) { // 读取sensor字段的值 YAML::Node sensor = config["sensor"]; if (sensor["imu"]) { std::string imuInclude = sensor["imu"]["include"].as<std::string>(); std::cout << "imu include: " << imuInclude << std::endl; } if (sensor["gnss"]) { std::string gnssInclude = sensor["gnss"]["include"].as<std::string>(); std::cout << "gnss include: " << gnssInclude << std::endl; } if (sensor["odom"]) { std::string odomInclude = sensor["odom"]["include"].as<std::string>(); std::cout << "odom include: " << odomInclude << std::endl; } if (sensor["lidar"]) { std::string lidarInclude = sensor["lidar"]["include"].as<std::string>(); std::cout << "lidar include: " << lidarInclude << std::endl; } if (sensor["camera"]) { std::string cameraInclude = sensor["camera"]["include"].as<std::string>(); std::cout << "camera include: " << cameraInclude << std::endl; } if (sensor["radar"]) { std::string radarInclude = sensor["radar"]["include"].as<std::string>(); std::cout << "radar include: " << radarInclude << std::endl; } } } int main() { // 加载YAML文件 YAML::Node config = YAML::LoadFile("config.yaml"); // 读取配置 readConfig(config); return 0; } ``` 请确保将上述示例代码与YAML-CPP库一起编译、链接并运行。从YAML文件中读取的值将打印到控制台上。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值