eclipse-vertx/vert.x · error · RuntimeException

Resource not found: ${sourceName}

Error message

Resource not found: ${sourceName}

What it means

Construction failure in CompilingClassLoader: the .java source resource named by sourceName cannot be found via getResource on the parent classloader. The resource name is included; the input at fault is the sourceName string used to locate the Java source for dynamic compilation.

Source

Thrown at vertx-core/src/main/java/io/vertx/core/impl/verticle/CompilingClassLoader.java:47

import static io.vertx.core.internal.net.RFC3986.decodeURIComponent;

/**
 *
 * Classloader for dynamic .java source file compilation and loading.
 *
 * @author Janne Hietamäki
 */
public class CompilingClassLoader extends ClassLoader {

  private static final Logger log = LoggerFactory.getLogger(CompilingClassLoader.class);

  private final JavaSourceContext javaSourceContext;
  private final MemoryFileManager fileManager;
  public CompilingClassLoader(ClassLoader loader, String sourceName) {
    super(loader);
    URL resource = getResource(sourceName);
    if (resource == null) {
      throw new RuntimeException("Resource not found: " + sourceName);
    }
    //Need to urldecode it too, since bug in JDK URL class which does not url decode it, so if it contains spaces you are screwed
    final File sourceFile = new File(decodeURIComponent(resource.getFile(), false));
    if (!sourceFile.canRead()) {
      throw new RuntimeException("File not found: " + sourceFile.getAbsolutePath() + " current dir is: " + new File(".").getAbsolutePath());
    }

    this.javaSourceContext = new JavaSourceContext(sourceFile);

    try {
      DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
      JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
      if (javaCompiler == null) {
        throw new RuntimeException("Unable to detect java compiler, make sure you're using a JDK not a JRE!");
      }
      StandardJavaFileManager standardFileManager = javaCompiler.getStandardFileManager(null, null, null);

      standardFileManager.setLocation(StandardLocation.SOURCE_PATH, Collections.singleton(javaSourceContext.getSourceRoot()));

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Correct the source name so it resolves on the classpath
  2. Ensure the .java file is packaged as a resource in the verticle jar/bundle
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at vertx-core/src/main/java/io/vertx/core/impl/verticle/CompilingClassLoader.java:47 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of eclipse-vertx/vert.x@fb308bd8c3 (2026-09-06). Data as JSON: /api/errors/63f2634f3bcdf727. Report an issue: GitHub.