stanfordnlp/CoreNLP · error · IllegalStateException
Could not find java.util.logging in your classpath
Error message
Could not find java.util.logging in your classpath
What it means
Handlers.javaUtil Thunk wraps construction of a JavaUtilLoggingHandler; any Exception during creation is rethrown as this IllegalStateException. Despite the message, java.util.logging is part of the JDK, so failures are almost always reflective/linkage errors in exotic environments.
Solutions
- Check the cause chain to see the actual class that failed to load; in modern JDKs java.util.logging is always present, so suspect the classloader.
- Switch to Handlers.stderr or Handlers.output which need no java.util.logging.
- If running a custom runtime image, include the java.logging module (jlink --add-modules java.logging).
- Initialize java.util.logging (LogManager) once early to surface the real underlying error.
Example fix
// before RedwoodConfiguration.empty().handlers(Handlers.javaUtil).apply(); // after RedwoodConfiguration.empty().handlers(Handlers.stderr).apply(); // or add java.logging module to runtime image
Defensive patterns
Strategy: fallback
Validate before calling
private static boolean javaUtilLoggingAvailable() {
try { Class.forName("java.util.logging.Logger"); return true; }
catch (ClassNotFoundException e) { return false; }
} Try / catch
try {
config.handlers(Handlers.javaUtil).apply();
} catch (IllegalStateException e) {
if (e.getMessage().contains("Could not find java.util.logging")) {
config.handlers(Handlers.stderr).apply();
} else throw e;
} Prevention
- Ensure the runtime image includes the java.logging module (jlink --add-modules java.logging).
- Read the cause chain to distinguish a stripped JRE from a classloader problem.
- Prefer Handlers.output/stderr in constrained deployment environments.
When it happens
Trigger: Using Handlers.javaUtil (log.handlers containing javaUtil) in a constrained JVM where java.util.logging classes fail to load, or where the handler construction throws (e.g. NoClassDefFoundError-style Exception in stripped JREs).
Common situations: Running on a stripped/minimal JRE image without java.util.logging module; unusual classloader setups (old app servers) that block java.util.logging; extremely rare genuine ClassNotFound situations.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- Could not find SLF4J in your classpath
- Bad serialized file:
- Called remove() before any elements returned
- Cannot initialize logger!
- Cannot initialize logger!
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/c08fd9d2561ee2e6.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/util/logging/RedwoodConfiguration.java:249
try {
OutputHandler handler = MetaClass.create("edu.stanford.nlp.util.logging.SLF4JHandler").createInstance();
handler.leftMargin = config.channelWidth;
root.addChild(handler);
} catch (Exception e) {
throw new IllegalStateException("Could not find SLF4J in your classpath", e);
}
};
/**
* Output to java.util.Logging. This is a leaf node.
*/
public static final Thunk javaUtil = (config, root) -> {
try {
OutputHandler handler = new JavaUtilLoggingHandler();
handler.leftMargin = config.channelWidth;
root.addChild(handler);
} catch (Exception e) {
throw new IllegalStateException("Could not find java.util.logging in your classpath", e);
}
};
/**
* Output to the default location specified by the output() method.
* Consider using this rather than stderr or stdout.
*/
public static final Thunk output = (config, root) -> {
config.outputHandler.leftMargin = config.channelWidth;
root.addChild(config.outputHandler);
};
//
// Filters
//
/**
* Hide the debug channel only.
*/View on GitHub (pinned to 1b7edd19c4)