apache/druid · error · UnsupportedOperationException
Unable to create URL classpath entry
Error message
Unable to create URL classpath entry
What it means
Thrown by JvmUtils.systemClassPath when one of the entries of the java.class.path system property cannot be converted to a java.net.URL via Paths.get(s).toUri().toURL(), which throws MalformedURLException. The error is wrapped in UnsupportedOperationException with the original cause attached.
Solutions
- Inspect the java.class.path property for the offending entry (the exception cause identifies it)
- Start Druid with the standard druid launcher script rather than a custom -cp
- Remove or quote unusual characters (spaces, wildcards, URL-style entries) from the classpath
- If a path legitimately contains special characters, pass it as a proper filesystem path, not a URL string
Example fix
// before java -cp "lib/*:conf/druid:file:/opt/my lib/x.jar" ... // after java -cp "lib/*:conf/druid:/opt/my\\ lib/x.jar" ...
Defensive patterns
Strategy: try-catch
Validate before calling
for (String s : System.getProperty("java.class.path").split(File.pathSeparator)) {
try { new java.io.File(s).toPath().toUri().toURL(); }
catch (Exception e) { log.error("Bad classpath entry: {}", s); }
} Try / catch
try {
List<URL> urls = JvmUtils.systemClassPath();
} catch (UnsupportedOperationException e) {
log.error("Classpath entry malformed, cause={}", e.getCause());
throw e;
} Prevention
- Launch Druid with the standard launcher instead of hand-built -cp values
- Avoid URL-style or wildcard entries in java.class.path
- Quote paths containing spaces when assembling the classpath
When it happens
Trigger: Running code that builds a classpath URL list (used for task/child-process classpaths) while java.class.path contains an entry that produces a malformed URI - typically entries with invalid characters (spaces in exotic setups, unclosed jar syntax like 'file:...!' references) or a null element in the paths array.
Common situations: Custom launcher scripts that assemble the classpath manually, environments where Druid is started with a hand-built -cp containing URLs or wildcard entries, OSGi-like containers injecting unusual classpath strings.
Understand the failure class
Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.
Related errors
- 08001
- Bad URL
- Cannot determine maxDirectMemory from
- Cannot figure out default port for protocol
- Cannot load JDBC driver class
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/e2a610f23f846561.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/utils/JvmUtils.java:138
try {
return function.get();
}
finally {
accumulator.addAndGet(safeGetThreadCpuTime() - start);
}
}
public static List<URL> systemClassPath()
{
List<URL> jobURLs;
String[] paths = System.getProperty("java.class.path").split(File.pathSeparator);
jobURLs = Stream.of(paths).map(
s -> {
try {
return Paths.get(s).toUri().toURL();
}
catch (MalformedURLException e) {
throw new UnsupportedOperationException("Unable to create URL classpath entry", e);
}
}
).collect(Collectors.toList());
return jobURLs;
}
/**
* Get the total memory of the machine it is running on. This function is container aware.
* If the machine is running in a container, the function will return the total memory of the container.
* If the machine is not running in a container, the function will return the total memory of the machine.
* @return the total memory of the machine it is running on in bytes.
*/
public static long getTotalMemory()
{
return OPERATING_SYSTEM_MX_BEAN.getTotalPhysicalMemorySize();
}
}
View on GitHub (pinned to 9b90983fd2)