Skip to content
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

Add a note about classloader issues to README #597

Merged
merged 3 commits into from
Nov 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,15 @@ If you have trouble with your configuration, some useful tips.
string with comments showing where each value came from.
This string can be printed out on console or logged to
a file etc.
- If you see errors like
`com.typesafe.config.ConfigException$Missing: No configuration setting found for key foo`,
and you're sure that key is defined in your config file, they might appear e.g.
when you're loading configuration from a thread that's not the JVM's main thread.
Try passing the `ClassLoader` in manually - e.g. with `ConfigFactory.load(getClass().getClassLoader())`
or setting the context class loader.
If you don't pass one, Lightbend Config uses the calling thread's `contextClassLoader`, and in some cases,
it may not have your configuration files in its classpath,
so loading the config on that thread can yield unexpected, erroneous results.

### Supports Java 8 and Later

Expand Down