{"record":{"id":"36972a85d0c2e5af","repo":"stanfordnlp/CoreNLP","slug":"class-at-path","errorCode":null,"errorMessage":"Class at path ","messagePattern":"Class at path ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/edu/stanford/nlp/util/ArgumentParser.java","lineNumber":200,"sourceCode":"  private static Class filePathToClass(String cpEntry, String path) {\n    if (path.length() <= cpEntry.length()) {\n      throw new IllegalArgumentException(\"Illegal path: cp=\" + cpEntry\n          + \" path=\" + path);\n    }\n    if (path.charAt(cpEntry.length()) != '/') {\n      throw new IllegalArgumentException(\"Illegal path: cp=\" + cpEntry\n          + \" path=\" + path);\n    }\n    path = path.substring(cpEntry.length() + 1);\n    path = path.replaceAll(\"/\", \".\").substring(0, path.length() - 6);\n    try {\n      return Class.forName(path,\n          false,\n          ClassLoader.getSystemClassLoader());\n    } catch (ClassNotFoundException e) {\n      throw fail(\"Could not load class at path: \" + path);\n    } catch (NoClassDefFoundError ex) {\n      warn(\"Class at path \" + path + \" is unloadable\");\n      return null;\n    }\n  }\n\n  private static boolean isIgnored(String path) {\n    return Arrays.stream(IGNORED_JARS).anyMatch(path::endsWith);\n  }\n\n  private static Class<?>[] getVisibleClasses() {\n    //--Variables\n    List<Class<?>> classes = new ArrayList<>();\n    // (get classpath)\n    String pathSep = System.getProperty(\"path.separator\");\n    String[] cp = System.getProperties().getProperty(\"java.class.path\",\n        null).split(pathSep);\n    // --Fill Options\n    // (get classes)\n    for (String entry : cp) {","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/util/ArgumentParser.java#L182-L218","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add the missing dependency jar(s) that the unloadable class needs to the classpath","Check the earlier 'debug' output for the underlying NoClassDefFoundError cause and fix the classpath entry","If the class is irrelevant, ignore the warning - argument parsing continues without it","Verify no duplicate/conflicting versions of the dependency exist on the classpath"],"exampleFix":"// before: java -cp corenlp.jar edu.stanford.nlp.pipeline.StanfordCoreNLPServer ...\n// after: include all bundled deps\nclasspath=\"$(find lib -name '*.jar' | tr '\\n' ':')corenlp.jar\"\njava -cp \"$classpath\" edu.stanford.nlp.pipeline.StanfordCoreNLPServer ...","handlingStrategy":"fallback","validationCode":"// before passing the class to ArgumentParser\nClass<?> c;\ntry {\n    c = Class.forName(path, false, ClassLoader.getSystemClassLoader());\n} catch (ClassNotFoundException | NoClassDefFoundError e) {\n    System.err.println(\"Skipping unloadable class: \" + path + \" (\" + e + \")\");\n    return;\n}","typeGuard":"static boolean isLoadable(String path) {\n    try { Class.forName(path, false, ClassLoader.getSystemClassLoader()); return true; }\n    catch (ClassNotFoundException | NoClassDefFoundError e) { return false; }\n}","tryCatchPattern":null,"preventionTips":["Run with the full dependency classpath (use the bundled CoreNLP jars or a dependency manager)","Test class loading of all pipeline classes at startup","Avoid mixing dependency versions; run `mvn dependency:tree` to spot conflicts"],"tags":["java","classpath","reflection","class-loading"],"backgroundTag":"class-not-found","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}