{"record":{"id":"e2a610f23f846561","repo":"apache/druid","slug":"unable-to-create-url-classpath-entry","errorCode":null,"errorMessage":"Unable to create URL classpath entry","messagePattern":"Unable to create URL classpath entry","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/utils/JvmUtils.java","lineNumber":138,"sourceCode":"    try {\n      return function.get();\n    }\n    finally {\n      accumulator.addAndGet(safeGetThreadCpuTime() - start);\n    }\n  }\n\n  public static List<URL> systemClassPath()\n  {\n    List<URL> jobURLs;\n    String[] paths = System.getProperty(\"java.class.path\").split(File.pathSeparator);\n    jobURLs = Stream.of(paths).map(\n        s -> {\n          try {\n            return Paths.get(s).toUri().toURL();\n          }\n          catch (MalformedURLException e) {\n            throw new UnsupportedOperationException(\"Unable to create URL classpath entry\", e);\n          }\n        }\n    ).collect(Collectors.toList());\n    return jobURLs;\n  }\n\n  /**\n   * Get the total memory of the machine it is running on. This function is container aware.\n   * If the machine is running in a container, the function will return the total memory of the container.\n   * If the machine is not running in a container, the function will return the total memory of the machine.\n   * @return the total memory of the machine it is running on in bytes.\n   */\n  public static long getTotalMemory()\n  {\n    return OPERATING_SYSTEM_MX_BEAN.getTotalPhysicalMemorySize();\n  }\n}\n","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/utils/JvmUtils.java#L120-L156","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\njava -cp \"lib/*:conf/druid:file:/opt/my lib/x.jar\" ...\n// after\njava -cp \"lib/*:conf/druid:/opt/my\\\\ lib/x.jar\" ...","handlingStrategy":"try-catch","validationCode":"for (String s : System.getProperty(\"java.class.path\").split(File.pathSeparator)) {\n  try { new java.io.File(s).toPath().toUri().toURL(); }\n  catch (Exception e) { log.error(\"Bad classpath entry: {}\", s); }\n}","typeGuard":null,"tryCatchPattern":"try {\n  List<URL> urls = JvmUtils.systemClassPath();\n} catch (UnsupportedOperationException e) {\n  log.error(\"Classpath entry malformed, cause={}\", e.getCause());\n  throw e;\n}","preventionTips":["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"],"tags":["classpath","url","jvm"],"backgroundTag":"invalid-url","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}