java-buildpack icon indicating copy to clipboard operation
java-buildpack copied to clipboard

After disabling Spring Auto Reconfiguration, application is not able to connect to config server(this leads to placeholder resolve problem)

Open dev-praveen opened this issue 1 year ago • 4 comments

We have a spring boot application that is deployed in PCF and works fine until we tried to migrate it to java-cfenv-boot library by following the migration guide and removing the dependencies it suggests. However, we encounter a problem with the centralized configuration. The application fails to get the placeholder values from the Spring Cloud Config Server (bound to PCF). This is the error we get: [OUT] Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder ‘some.value’ in value “${some.value}”

removed org.springframework.boot:spring-boot-starter-cloud-connectors or org.springframework.cloud:spring-cloud-core org.springframework.cloud:spring-cloud-connectors-core org.springframework.cloud:spring-cloud-cloudfoundry-connector org.springframework.cloud:spring-cloud-spring-service-connector dependencies from pom file

added

io.pivotal.cfenv java-cfenv-boot 2.4.0 dependency spring.profiles.active: dev,cloud JBP_CONFIG_SPRING_AUTO_RECONFIGURATION: '{enabled: false}'

Application couldn't able to locate the real config server and it is fall back to localhost 024-02-08T17:22:22.762+05:30 [APP/PROC/WEB/0] [OUT] 2024-02-08 11:52:22.761 INFO 8 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8888/ 2024-02-08T17:22:22.892+05:30 [APP/PROC/WEB/0] [OUT] 2024-02-08 11:52:22.892 WARN 8 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/application/dev,cloud": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused) 2024-02-08T17:22:22.895+05:30 [APP/PROC/WEB/0] [OUT] 2024-02-08 11:52:22.895 INFO 8 --- [ main] c.t.a.s.migration.Application : The following profiles are active: dev,cloud

without removing the above dependencies below are the logs

2024-01-25T12:52:52.305+05:30 [APP/PROC/WEB/0] [OUT] 2024-01-25 07:22:52.305 INFO 7 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: https://config-server-11121121a-fdec-4ba5-c654-5ccff667744.apps.np.app.com/

2024-01-25T12:52:54.122+05:30 [APP/PROC/WEB/0] [OUT] 2024-01-25 07:22:54.122 INFO 7 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource [name='configService', propertySources=[MapPropertySource {name='credhub-app-dev-master'}, MapPropertySource {name='credhub-app-dev-master'}, MapPropertySource {name='ssh://[email protected]:22/var/vcap/store/mirror/8475euhfjy348573857rjhgdfjh745647/davinci-config/davinci-app-dev.properties'}, MapPropertySource {name='ssh://[email protected]:22/var/vcap/store/mirror/8475euhfjy348573857rjhgdfjh745647/davinci-config/application.properties'}]]

please help us why after removing recommended dependencies from the documentation application is not able to locate the real config server.

dev-praveen avatar Feb 09 '24 04:02 dev-praveen