stanfordnlp/CoreNLP · warning

Class at path

Error message

Class at path 

What it means

ArgumentParser.filePathToClass() tries to load a class by dotted name via Class.forName() using the system class loader. When the class is found but cannot be linked/initialized (NoClassDefFoundError, typically from a missing dependency of that class), the parser logs a warning 'Class at path <path> is unloadable' and returns null instead of throwing. The class will simply be excluded from argument-parsing consideration.

Solutions

  1. Add the missing dependency jar(s) that the unloadable class needs to the classpath
  2. Check the earlier 'debug' output for the underlying NoClassDefFoundError cause and fix the classpath entry
  3. If the class is irrelevant, ignore the warning - argument parsing continues without it
  4. Verify no duplicate/conflicting versions of the dependency exist on the classpath

Example fix

// before: java -cp corenlp.jar edu.stanford.nlp.pipeline.StanfordCoreNLPServer ...
// after: include all bundled deps
classpath="$(find lib -name '*.jar' | tr '\n' ':')corenlp.jar"
java -cp "$classpath" edu.stanford.nlp.pipeline.StanfordCoreNLPServer ...
Defensive patterns

Strategy: fallback

Validate before calling

// before passing the class to ArgumentParser
Class<?> c;
try {
    c = Class.forName(path, false, ClassLoader.getSystemClassLoader());
} catch (ClassNotFoundException | NoClassDefFoundError e) {
    System.err.println("Skipping unloadable class: " + path + " (" + e + ")");
    return;
}

Type guard

static boolean isLoadable(String path) {
    try { Class.forName(path, false, ClassLoader.getSystemClassLoader()); return true; }
    catch (ClassNotFoundException | NoClassDefFoundError e) { return false; }
}

Prevention

When it happens

Trigger: Calling ArgumentParser.fillOptions()/bootstrapMap() over classes or jars where a scanned class's static initializer or a superclass/interface references classes absent from the classpath, causing Class.forName(..., false, systemClassLoader) to throw NoClassDefFoundError.

Common situations: Running CoreNLP tools with an incomplete classpath (e.g. missing protobuf, joda-time, or javax dependencies); a jar on the classpath referencing classes from a newer/older dependency version; shaded jars with missing transitive deps; scanning all jars in a directory where some are broken.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/36972a85d0c2e5af. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/util/ArgumentParser.java:200

  private static Class filePathToClass(String cpEntry, String path) {
    if (path.length() <= cpEntry.length()) {
      throw new IllegalArgumentException("Illegal path: cp=" + cpEntry
          + " path=" + path);
    }
    if (path.charAt(cpEntry.length()) != '/') {
      throw new IllegalArgumentException("Illegal path: cp=" + cpEntry
          + " path=" + path);
    }
    path = path.substring(cpEntry.length() + 1);
    path = path.replaceAll("/", ".").substring(0, path.length() - 6);
    try {
      return Class.forName(path,
          false,
          ClassLoader.getSystemClassLoader());
    } catch (ClassNotFoundException e) {
      throw fail("Could not load class at path: " + path);
    } catch (NoClassDefFoundError ex) {
      warn("Class at path " + path + " is unloadable");
      return null;
    }
  }

  private static boolean isIgnored(String path) {
    return Arrays.stream(IGNORED_JARS).anyMatch(path::endsWith);
  }

  private static Class<?>[] getVisibleClasses() {
    //--Variables
    List<Class<?>> classes = new ArrayList<>();
    // (get classpath)
    String pathSep = System.getProperty("path.separator");
    String[] cp = System.getProperties().getProperty("java.class.path",
        null).split(pathSep);
    // --Fill Options
    // (get classes)
    for (String entry : cp) {

View on GitHub (pinned to 1b7edd19c4)