question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ConfigDataLocationNotFoundException thrown at application startup with configserver: config imports, that are not even meant for the current profile

See original GitHub issue

Since upgrading from 2.4.0 to 2.4.1 (same for 2.4.2-SNAPSHOT) my application fails to startup due the following exception;

  • Using Spring Cloud version 2020.0.0-RC1
06:46:34.776 [main] DEBUG org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter - Application failed to start due to an exception
org.springframework.boot.context.config.ConfigDataLocationNotFoundException: Config data location 'configserver:https://prod-configuration-server.org' cannot be found
	at org.springframework.boot.context.config.ConfigDataEnvironment.checkMandatoryLocations(ConfigDataEnvironment.java:360)
	at org.springframework.boot.context.config.ConfigDataEnvironment.applyToEnvironment(ConfigDataEnvironment.java:313)
	at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:233)
	at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:97)
	at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:89)
	at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:100)
	at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:86)

I think this is originally caused by improvements made in https://github.com/spring-projects/spring-boot/commit/3dc03ac2752a06e015fc8ae7a6eba483b2cc863e

This occurs with the following setup; (starting up with both default profile as the local profile (-Dspring.profiles.active=local)

spring:
  application:
    name: foobar
  profiles:
    active: local

---

spring:
  config:
    activate:
      on-profile: local, docker
    import: configserver:http://localhost:8888

---

spring:
  config:
    activate:
      on-profile: dev, test
    import: configserver:https://test-configuration-server.org

---

spring:
  config:
    activate:
      on-profile: acc
    import: configserver:https://acc-configuration-server.org

---

spring:
  config:
    activate:
      on-profile: prd
    import: configserver:https://prod-configuration-server.org

In my understanding this exception is thrown because all mandatory locations are checked, and not just one from the active profile. I would expect it to nicely skip the configserver: imports for both dev, test, acc, prd in the above example. Even though they are not optional, they are not meant for the active profile either.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
snicollcommented, Dec 23, 2020

@mbhave shouldn’t this be flagged a regression?

1reaction
mbhavecommented, Dec 22, 2020

Thanks for checking @dnijssen. I was able to reproduce this in Spring Boot. I think it’s a bug that we check mandatory locations even when the profile isn’t active.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable config service client activated with spring.config ...
configserver.import = The now empty spring.config.import property will not be considered anymore. This would even work with -D JVM launch ...
Read more >
Config file processing in Spring Boot 2.4
Profiles can no longer be activated from profile specific documents. Document Order. Starting with Spring Boot 2.4, there will be a simple rule ......
Read more >
spring-projects/spring-boot v2.4.2 on GitHub - NewReleases.io
... ConfigDataLocationNotFoundException thrown at application startup with configserver: config imports, that are not even meant for the current profile # ...
Read more >
Spring Cloud Config — Understanding the Basics - Medium
This will run our Spring Boot application as a config server. package com.example.microservices.configserver;import org.springframework.boot ...
Read more >
[GitHub] [isis] dependabot[bot] opened a new pull request #336 ...
... <li>ConfigDataLocationNotFoundException thrown at application startup with configserver: config imports, that are not even meant for the current profile ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found