New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConfigDataResourceNotFoundException incorrectly thrown for valid classpath locations #24143
Comments
Thanks for the report, @bratkartoffel. I've tried to reproduce the behaviour that you have described but have been unable to do so. Specifying the root of the classpath as a If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue. |
I've created a minimal example and could reproduce this. While testing I found out, that this only happens when running on Java 8. Using Java 11 is fine. Running in IntelliJ works also fine. |
Thanks for the sample, @bratkartoffel. I've reproduced the problem. The failure seems to be due to a difference in how the root of the classpath is resolved. As you have observed, this difference is specific to Java 8. It also only occurs when there are only jars on the classpath. If I modify the
We'll continue to investigate to see what a potential fix may be. Rather than adding a directory to the classpath, an alternative workaround is to enable legacy configuration file processing by setting
|
The following references are being resolved:
The directory for each of these is Modifying the sample's main method to output the result of the Modifying the sample to apply Spring Boot's plugin and building and running a fat jar produces Modifying the sample to remove |
I think we've been here before: spring-projects/spring-framework#16711. |
Please pay attention to this issue again.I encountered the same problem in version 2.4.1, and I returned to 2.4.0 and it was normal. I use graalvm 20.3.0 OpenJDK11.0.9 Description: Config data location 'classpath:/' does not exist Action: Check that the value 'classpath:/' is correct, or prefix it with 'optional:' This is my code |
Thanks for letting us know. FWIW this project works fine for me with Spring Boot |
I can't use 2.4.2-SNAPSHOT and the following error is displayed: Plugin [id: 'org.springframework.boot', version: '2.4.2-SNAPSHOT'] was not found in any of the following sources: Even if I use spring initializr to generate new projects, the same error occurs. I noticed the modification of 2.4.1 on this issue. If there is no property file in the classpath:/ path, an error will be thrown: Config data location'classpath:/' does not exist If I add the properties file in the classpath:/ path, everything is normal. I do need to have no properties files in the directory. Can the modification ignore this judgment? |
A project generated using start.spring.io works fine for me. Perhaps you're trying to adapt the new project to your existing project and you forgot to update |
The project I generated at start.spring.io used gradle project before, but now I use maven and it is indeed normal. This is the demo I used to reproduce the issue with version 2.4.2-SNAPSHOT |
Hello, 1-context xml file :Environment name="spring.config.additional-location" value="file:/opt/etc/" type="java.lang.String"
|
@wafim From what you've described, that doesn't sound related to this issue. If you'd like us to investigate, please open a new issue and provide a minimal sample that reproduces the problem. |
Hi,
after upgrading from spring boot 2.3.6 to 2.4.0 our application fails to startup. We tracked the error to our startup options, we use the following to setup the configuration resources paths:
--spring.config.location=classpath:/,file:../etc/
This results in the following error message:
The same setting works fine on the previous spring boot version.
We need this setting as we ship some default profiles within our jar, but also allow the user to use custom profiles within the "etc" folder.
Prefixing the "classpath:" with "optional:" doesn't print any error, but then the embedded profiles are not found.
Thanks,
Simon
The text was updated successfully, but these errors were encountered: