spring-cloud / spring-cloud-config

External configuration (server and client) for Spring Cloud
Apache License 2.0
1.94k stars 1.28k forks source link

Could not locate PropertySource and the resource is not optional, failing #2434

Open ykudale2012 opened 5 days ago

ykudale2012 commented 5 days ago

I have upgraded spring boot 2.7.7 to 3.1.11 and spring cloud dependencies to 2022.0.4, I am able to build the app but facing below issue while starting the application.

org.springframework.cloud.config.client.configClientFallfastException: Could not locate PropertySource and the resource is not optional, failing

at org.springframework.cloud.config.client.configServerConfigDataLoader.doload(ConfigServerConfigDatatoader.java: 201) at org.springframework.cloud.config.client.configClientRetryBootstrapper.lambdalinitializeś1(ConfigClientRetryBootstrapper.java:54)

at org.springframework.cloud.config. client.configServerConfigDataLoader.load(ConfigServerConfigDataLoader.java:93)

at org.springframework. cloud.config.client.ConfigServerConfigDataloader.load(ConfigServerConfigDataLoader.java:61)

at org.springframework.boot.context.config.ConfigDataloaders, load(ConfigDataLoaders.java:96) at org.springframework.boot.context.config.ConfigDataImporter load(ConfigDataImporter.java:137)

at org.springframework, boot.context.config.ConfigDataimporter.resolveAndLoad(ConfigDataImporter.java:87) at org.springframework.boot.context.config.ConfigDatal.nvironmentContributors withProcessedImports (ConfigDatal nvironment Contributors.java:115)

at org.springframework.boot.context.config.ConfigDataEnvironment.processInitial(ConfigDataEnvironment.java:242) at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment. Java:229)

at org.springframework.boot.context.config.ConfigData Environment PostProcessor.post ProcessEnvironment (ConfigDataEnvironmentPostProcessor.java:96) org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcess Environment (ConfigDataEnvironmentPostProcessor.java:9) at

at org.springframework.boot.env. Environment PostProcessor ApplicationListener.onapplicationEnvironment PreparedEvent (EnvironmentPostProcessorApplicationListener.java:180)

Listener.onApplicationEvent(EnvironmentPostProcessorApplicationiistener.java:94)

at org.springframework.boot.env. Environment Post ProcessorApplicationti at org.springframework.contest.event. SimpleApplicationEventfulticaster.doInvokel istener(SimpleApplicationEventmulticaster.java:185) at org.springframework.context.event. SimpleApplicationEventMulticaster. Invokelistener(SimpleApplicationt ventilulticaster.java:178)

at org.springframework.context.event. SimpleApplicationEventRulticaster multicastEvent(SimpleApplicationEventhalticaster.java:156) at org.springframework.context.event.SimpleApplicationEventfulticaster multicastEvent(Simple@pplicationEventMulticaster.java:138) multicastInitial Event (EventPublishingRunListener.java:136)

at org.springframework.boot.context.event.EventPublishingRunListener

org.springframework.boot.context.event.EventPublishingRuni istener.environment Prepared(EventPublishingRunListener.java:81) at at org.springframework.boot SpringApplicationRunt.isteners lambdas environment Prepared57(SpringApplicationRuni Isteners.java:64)

at java.base/java.lang.Iterable.forEach(Unknown Source) at org.springframework.boot SpringApplicationRuntisteners.dokithlisteners(SpringApplicationkunt isteners.java:118)

at org.springframework.boot.SpringApplicationRunListeners.dowithlisteners(SpringApplicationkuni Isteners.java:117) at org.springframework.boot SpringApplicationRunListeners.environment Prepared(SpringApplicationRunListeners.java:63) org.springframework.boot SpringApplication.prepareEnvironment (SpringApplication.java:369)

at

org.springframework.boot SpringApplication.run(SpringApplication.java:129)

at at org.springframework.boot.builder SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) at org.springframework.cloud.bootstrap. BootstrapApplicationi istener bootstrapServiceContext(BootstrapApplicationi istener.java:1953

at org.springframework.cloud.bootstrap.BootstrapApplicationiistener.onApplicationEvent(BootstrapApplicationListener.java:114) at org.springframework.cloud.bootstrap. BootstrapApplicationListener.onApplicationEvent (BootstrapApplicationtistener.java:77)

at org.springframework.context.event SimpleApplicationEventMulticaster, do Invokel istener(SimpleApplicationEventfulticaster.java:185) at org.springframework.context.event SimpleApplic ationEventMult ticaster.invokelistener(Simpl leApplicationEventMulticaster.java:178) at org.springframework.context.event.SimpleApplicationt ventMulticaster.multicastEvent(SimpleApplicationEventhulticaster.java:156)

at org.springframework.context.event.SimpleApplicationiventulticaster.multicastfvent(SimpleApplicationEventMulticaster.java:135) at org.springframework.boot.context.event.EventPublishingRuntistener.multicastInitialEvent (EventPublishingRunListener.java:136)

at org.springframework.boot.context.event.EventPublishingRunListener.environment Prepared(EventPublishingRumiistener.java:83)

at org.springframework, boot SpringApplicationRunListeners. lambdaßenvironment Prepared$2 ( at java.base/java.lang.Iteratile, forEach(Unknown Source) SpringApplicationRuntisteners, Java:64)

at org.springframework.boot. SpringApplicationRunListeners, doalitht isteners (SpringApplicationRunListeners.java:118) (SpringApplicationkunListeners.java:112)

at org.springframework.boot SpringApplicationluntisteners.dowithiisteners at org.springframework.boot SpringApplicationRunListeners.environment Prepared(SpringApplicationRunListeners.java:63)

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

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

at org.springframework.boot SpringApplication.run(SpringApplication.java:1343) at com.efx.pet.product.fulfillment ProductfulfillmentApplice cation.main(ProductfulfillmentApplication.java:37)

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

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) hase/20k. Internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

Caused by: org.springframework.web.client.HttpServer ErrorException$Internal Server Error: 500: "("timestamp":"2024-06-21107:55:18.262+0000", "status":500,"error":Server Error", "message": "No message available", "path":"/configuration-server/application/default")"

"Internal at org.springframework.web.client.HttpServerErrorException.create(HttpServer ErrorException.java:102) (DefaultResponse ErrorHandler.java:186)

at org.springframework.web.client.DefaultResponse ErrorHandler.handleError at org.springframework.web.client.DefaultResponse ErrorHandler.handleError (DefaultResponse ErrorHandler.java:137) )

at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63 at org.springframework.web.client. Rest Template.handleResponse (Rest Template.java:942)

at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:891) Template.execute(RestTemplate.java:790)

at org.springframework.web.client. Rest at org.springframework.web.client.RestTemplate.exchange (RestTemplate.java:672)

at org.springframework.cloud.config.client.ConfigServerConfigDataLoader.getRemoteEnvironment (ConfigServerConfigDataloader.java:330)

at org.springframework.cloud.config.client.ConfigServerConfigDataLoader.doload(ConfigServerConfigDataloader.java:119)

ykudale2012 commented 5 days ago

@ryanjbaxter could you have a look Into this?

ryanjbaxter commented 5 days ago

Seems like there is an error on the config server is there anything in the logs on the config server?

ykudale2012 commented 4 days ago

@ryanjbaxter with same configuration server, we are able to run my previous application which is using Spring Boot 2.7.7 and related compatible dependency, we have not done any changes in Server, did changes in client app only, still getting issue.

ryanjbaxter commented 4 days ago
Caused by: org.springframework.web.client.HttpServer ErrorException$Internal Server Error: 500: "("timestamp":"2024-06-21107:55:18.262+0000", "status":500,"error":Server Error", "message": "No message available", "path":"/configuration-server/application/default")"

A 500 error would indicate an error on the server, can you check the logs there?

ykudale2012 commented 4 days ago

@ryanjbaxter but from my configuration client I have set app name- product-fulfill and profile- dev, Still in the exception why it is showing path":"/configuration-server/application/default"?

ryanjbaxter commented 4 days ago

If you give us a sample to reproduce we can provide better insights

ykudale2012 commented 4 days ago

Actually, I tried to reproduce this issue on local but we are not able to reproduce, this issue is coming only on server while deployment. Is there anything like if we have upgraded cloud configuration Springboot version, so server version needs to be upgraded?

ryanjbaxter commented 4 days ago

We don’t guarantee compatibility across major versions but I don’t see why the client would not be making the correct request due to that.

ykudale2012 commented 4 days ago

@ryanjbaxter I can't fetch server logs but let me try to fetch the configuration server logs. Meanwhile please let me know if any other things which I can verify in my application and configuration server.

ykudale2012 commented 3 days ago
Caused by: org.springframework.web.client.HttpServer ErrorException$Internal Server Error: 500: "("timestamp":"2024-06-21107:55:18.262+0000", "status":500,"error":Server Error", "message": "No message available", "path":"/configuration-server/application/default")"

A 500 error would indicate an error on the server, can you check the logs there?

@ryanjbaxter - config server logs attached below

2024-06-20102:52:51,3502 [http-nio-0000-exec-201 ERROR ( springAppName Is UNDEFINED,, org.apache.juli.logging.Direct Blog:log() [] Servier servicel) for servlet (dispatcherServlet) in context with path /configuration-server] threw exception [Request processing failed; nested exceptam 20 java.lang.NullPointerException) with root cause
java.lang.NullPointerException: null
at java.base/java.util.HashMap.putMapEntries (HashMap.java:496)
at java.base/java.util.LinkedHashMap.<init>(LinkedHashMap.java:304)
at org.springframework.cloud.config.server.encryption. CipherEnvironmentEncryptor.decrypt (CipherEnvironment.Encryptor.java:64)
at org.springframework.cloud.config.server.encryption.CipherEnvironmentEncryptor.decrypt(CipherEnvironment Encryptor.java:56)
at org.springframework.cloud.config.server.environment. Environment.EncryptorEnvironment Repository. findOne (EnvironmentEncryptorEnvironment Repository.javer at org.springframework.cloud.config.server.environment. EnvironmentController.labelled (EnvironmentController.java:114)
at org.springframework.cloud.config.server.environment. EnvironmentController.defaultlabel (EnvironmentController.java:106)
at jdk.internal.reflect.GeneratedMethodAccessor95. invoke (Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke (Method.java:566) at
org.springframework.util.ReflectionUtils.invokeMethod (ReflectionUtils.java:282)
at org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean, invoke (Genericscope.java:499) at org.springframework.aop.framework.ReflectiveMethodInvocation-proceed (ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed (CglihAopProxy.java:747) at org.springframework.sop.framework.CglibAopProxy DynamicAdvisedInterceptor.intercept (ColibAopProxy.java:669)
at org.springframework.cloud.config.server.environment. EnvironmentController50EnhancerBylpringCOLTHS510472566.defaulttabel (<generated?)
at jok internal.reflect.GeneratedMethodAccessor95.invoke (Unknown Source) at
ryanjbaxter commented 3 days ago

This is really strange. This exception would indicate that there was an error decrypting a property before the config server returns the response. That would have nothing to do with the version of spring boot or spring cloud the client is using