quarkusio/quarkus · error · RuntimeException
Unable to create protection domain for
Error message
Unable to create protection domain for
What it means
Thrown from PathTreeClassPathElement.getProtectionDomain when converting the element's root Path to a URL fails with MalformedURLException, wrapped in a RuntimeException. Protection domains need a CodeSource URL; if the path cannot be expressed as a valid URL the domain cannot be built. This indicates an unrepresentable/invalid root path.
Source
Thrown at independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/PathTreeClassPathElement.java:176
@Override
public boolean containsReloadableResources() {
return !pathTree.isArchiveOrigin();
}
@Override
public ManifestAttributes getManifestAttributes() {
return apply(OpenPathTree::getManifestAttributes);
}
@Override
public ProtectionDomain getProtectionDomain() {
URL url = null;
final Path root = getRoot();
try {
url = root.toUri().toURL();
} catch (MalformedURLException e) {
throw new RuntimeException("Unable to create protection domain for " + root, e);
}
CodeSource codesource = new CodeSource(url, (Certificate[]) null);
return new ProtectionDomain(codesource, null);
}
@Override
public void close() throws IOException {
lock.writeLock().lock();
try {
pathTree.close();
} finally {
lock.writeLock().unlock();
}
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();View on GitHub (pinned to e1c734241f)
Solutions
- Move/rename the application or its jars to a path without special characters
- Inspect the cause MalformedURLException to see which part of the path is invalid
- Quote/encode the path before launching the application
Example fix
// before java -jar /path with spaces/app-runner.jar // may yield unparseable URI // after java -jar "/path%20with%20spaces/app-runner.jar" // or avoid spaces entirely
Defensive patterns
Strategy: validation
Validate before calling
try {
new URL(root.toUri().toString());
} catch (MalformedURLException e) { /* path unrepresentable: relocate app */ } Prevention
- Launch the app from paths without spaces or special characters
- Verify the root path converts to a valid URI before running
- Avoid unusual mount points or encoded characters in install locations
When it happens
Trigger: Calling getProtectionDomain() on an element whose root Path produces a URI that URL cannot parse (unsupported/invalid URI scheme characters in the path).
Common situations: Paths with illegal characters (spaces or special characters on some platforms/JDKs) in the directory or jar location of the application.
Related errors
- Failed to translate
- Invalid URL:
- java.io.UncheckedIOException
- Unable to create protection domain for ${jarPath}
- Failed to create output directory for generated sources: %s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/3d65ecf5a1c3ec6f.
Report an issue: GitHub.