SonarSource/sonarqube · error · IllegalArgumentException
Logback configuration not found in classloader:
Error message
Logback configuration not found in classloader:
What it means
SonarQube configures Logback logging by loading a logback XML from the classpath. If getResourceAsStream returns null for the given classloader path, an IllegalArgumentException is thrown with the path appended.
Solutions
- Verify the logback configuration resource exists on the classpath at the exact given path
- Correct the classloaderPath string (leading slash, spelling)
- Add the logback file to the jar/classpath that loads it
Example fix
// before
Logback.configure("/conf/logback-custom.xml", vars);
// after
Logback.configure("/logback-custom.xml", vars); // resource actually packaged at root Defensive patterns
Strategy: validation
Validate before calling
if (Logback.class.getResourceAsStream(classloaderPath) == null) {
throw new IllegalArgumentException("Resource missing on classpath: " + classloaderPath);
}
Logback.configure(classloaderPath, vars); Try / catch
try {
Logback.configure(path, vars);
} catch (IllegalArgumentException e) {
LOG.warn("Logback config missing, using default", e);
Logback.configure("/logback.xml", vars);
} Prevention
- Verify resource path with getResourceAsStream before configuring
- Keep logback resources packaged in the same jar as the boot code
- Use constants for resource paths to avoid typos
When it happens
Trigger: Calling Logback.configure(classloaderPath, variables) with a path string that has no matching resource on the classpath (e.g. "/logback.xml" typo'd or not packaged).
Common situations: Custom logback file name that is not on the classpath; running in a stripped deployment where the logback resource was excluded; typo in resource path.
Understand the failure class
Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.
Related errors
- Fail to load the Logback configuration:
- log level in property is not a supported value (allowed…
- Unsupported value for property
- Unsupported value for property
- Address in property is not a valid address
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/917b2eb3cc77ffeb.
Report an issue: GitHub.
Appendix: source
Thrown at sonar-core/src/main/java/org/sonar/core/config/Logback.java:51
import org.slf4j.LoggerFactory;
/**
* Configure Logback
*
* @since 2.12
*/
public class Logback {
private static final StatusPrinter2 statusPrinter = new StatusPrinter2();
private Logback() {
// only statics
}
public static void configure(String classloaderPath, Map<String, String> substitutionVariables) {
InputStream input = Logback.class.getResourceAsStream(classloaderPath);
if (input == null) {
throw new IllegalArgumentException("Logback configuration not found in classloader: " + classloaderPath);
}
configure(input, substitutionVariables);
}
public static void configure(File logbackFile, Map<String, String> substitutionVariables) {
try {
FileInputStream input = FileUtils.openInputStream(logbackFile);
configure(input, substitutionVariables);
} catch (IOException e) {
throw new IllegalArgumentException("Fail to load the Logback configuration: " + logbackFile, e);
}
}
/**
* Note that this method closes the input stream
*/
private static void configure(InputStream input, Map<String, String> substitutionVariables) {
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();View on GitHub (pinned to 184c821202)