stanfordnlp/CoreNLP · critical · RuntimeException

ERROR: Could not find properties file in the classpath!

Error message

ERROR: Could not find properties file in the classpath!

What it means

When no explicit properties file is supplied, StanfordCoreNLP tries to load 'StanfordCoreNLP' or 'edu.stanford.nlp.pipeline.StanfordCoreNLP' from the classpath. If neither resource exists it throws this RuntimeException, meaning default configuration could not be located.

Solutions

  1. Pass a properties file explicitly: new StanfordCoreNLP("MyConfig.properties") or new StanfordCoreNLP(props).
  2. Place a file named StanfordCoreNLP.properties (or edu/stanford/nlp/pipeline/StanfordCoreNLP.properties) on the classpath.
  3. Ensure the resource is included in your build (e.g. maven resources filtering/excludes) and use the correct classloader.
  4. Call fromProperties/StanfordCoreNLP(Properties) variant instead of the classpath lookup.

Example fix

// before
StanfordCoreNLP pipeline = new StanfordCoreNLP(); // searches classpath, not found
// after
Properties props = new Properties();
props.setProperty("annotators", "tokenize,ssplit,pos");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
Defensive patterns

Strategy: fallback

Validate before calling

ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl.getResource("StanfordCoreNLP.properties") == null &&
    cl.getResource("edu/stanford/nlp/pipeline/StanfordCoreNLP.properties") == null) {
  log.warn("No default CoreNLP properties on classpath; supply Properties explicitly");
}

Try / catch

try { pipeline = new StanfordCoreNLP(); } catch (RuntimeException e) { pipeline = new StanfordCoreNLP(loadFallbackProps()); }

Prevention

When it happens

Trigger: Calling new StanfordCoreNLP() (no-arg constructor) or StanfordCoreNLP.fromClassPath() when the classpath contains no StanfordCoreNLP.properties-style resource under either valid name.

Common situations: Running CoreNLP from a jar/build setup where the default properties file was not packaged; wrong working directory or classloader in embedded/app-server contexts; shading the jar and dropping resources.

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/031ad8d61c0ff130. Report an issue: GitHub.

Appendix: source

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

      printRequiredProperties(System.err);
      throw new RuntimeException("Missing property: \"" + name + '\"');
    }
    return val;
  }

  /**
   * 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);

View on GitHub (pinned to 1b7edd19c4)