stanfordnlp/CoreNLP · critical · RuntimeIOException

ERROR: cannot find properties file

Error message

ERROR: cannot find properties file "${prefix}" in the classpath!

What it means

loadPropertiesOrException loads a properties file by its name prefix from the classpath and throws a RuntimeIOException if no resource matching that prefix was found. Unlike error 831, this names the specific prefix that was searched.

Solutions

  1. Check the exact prefix spelling and ensure a matching .properties resource exists on the classpath.
  2. Add the corresponding resource/model jar (e.g. stanford-corenlp-X-models, or the language-specific properties) to the classpath.
  3. Load the file from a filesystem path into a Properties object yourself and use the Properties constructor.
  4. If it must load, verify Thread.currentThread().getContextClassLoader() can see the resource (application-server classloader issues).

Example fix

// before
StanfordCoreNLP pipeline = new StanfordCoreNLP("StanfordCoreNLP-chinese"); // resource missing
// after
props.load(new FileInputStream("conf/StanfordCoreNLP-chinese.properties"));
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
Defensive patterns

Strategy: validation

Validate before calling

String res = prefix.endsWith(".properties") ? prefix : prefix + ".properties";
if (Thread.currentThread().getContextClassLoader().getResource(res) == null) {
  throw new IllegalStateException("Properties resource not on classpath: " + res);
}

Try / catch

try { pipeline = new StanfordCoreNLP(prefix); } catch (RuntimeIOException e) { log.error("Missing properties file for prefix {}: {}", prefix, e.getMessage()); throw e; }

Prevention

When it happens

Trigger: Calling new StanfordCoreNLP(propsFileNamePrefix) (String constructor) where no classpath resource exists matching the given prefix, e.g. new StanfordCoreNLP("StanfordCoreNLP-chinese") without that resource bundled.

Common situations: Typos in the properties file name; using a language-specific default (e.g. StanfordCoreNLP-arabic) whose resource jar (models) is not on the classpath; file present on disk but not on the classpath.

Understand the failure class

Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/pipeline/StanfordCoreNLP.java:423

  /**
   * Finds the properties file in the classpath and loads the properties from there.
   *
   * @return The found properties object (must be not-null)
   * @throws RuntimeException If no properties file can be found on the classpath
   */
  private static Properties loadPropertiesFromClasspath() {
    List<String> validNames = Arrays.asList("StanfordCoreNLP", "edu.stanford.nlp.pipeline.StanfordCoreNLP");
    for (String name : validNames) {
      Properties props = loadProperties(name);
      if (props != null) return props;
    }
    throw new RuntimeException("ERROR: Could not find properties file in the classpath!");
  }

  private static Properties loadPropertiesOrException(String propsFileNamePrefix) {
    Properties props = loadProperties(propsFileNamePrefix);
    if (props == null) {
      throw new RuntimeIOException("ERROR: cannot find properties file \"" + propsFileNamePrefix + "\" in the classpath!");
    }
    return props;
  }

  private static Properties loadProperties(String name) {
    return loadProperties(name, Thread.currentThread().getContextClassLoader());
  }

  private static Properties loadProperties(String name, ClassLoader loader) {
    // check if name represents a Stanford CoreNLP supported language
    if (LanguageInfo.isStanfordCoreNLPSupportedLang(name))
      name = LanguageInfo.getLanguagePropertiesFile(name);
    if(name.endsWith (PROPS_SUFFIX)) name = name.substring(0, name.length () - PROPS_SUFFIX.length ());
    name = name.replace('.', '/');
    name += PROPS_SUFFIX;
    Properties result = null;

    // Returns null on lookup failures

View on GitHub (pinned to 1b7edd19c4)