stanfordnlp/CoreNLP · error · RuntimeException

Error initializing binder

Error message

Error initializing binder ${bi}

What it means

The Options constructor instantiates Env.Binder classes listed in a properties option by fully-qualified class name and calls their init() with a property prefix. Any failure to load, instantiate, or initialize a binder is wrapped in a RuntimeException naming the binder (bi, typically 'binderN' identifier) with the underlying exception as cause.

Solutions

  1. Inspect the cause chain to see whether the class was not found, could not be instantiated, or its init() threw.
  2. Correct the fully-qualified binder class name in the properties file and ensure its jar/module is on the runtime classpath.
  3. Ensure each binder class is public with a public no-argument constructor and that all properties it requires are present.

Example fix

// before
binderClasses = edu.stanford.nlp.time.OldEnvBinder
// after
binderClasses = edu.stanford.nlp.time.RulesFormatterEnv$MyEnvBinder // corrected FQCN that exists on classpath
Defensive patterns

Strategy: try-catch

Validate before calling

String[] names = binderClassesCsv.split(",");
for (String n : names) {
  try { Class.forName(n.trim()); }
  catch (ClassNotFoundException e) { throw new IllegalArgumentException("Binder class not on classpath: " + n); }
}

Try / catch

try {
  Options opts = new Options(prefix, props);
} catch (RuntimeException e) {
  logger.severe("Binder init failed: " + e.getMessage() + ", cause: " + e.getCause());
  throw e;
}

Prevention

When it happens

Trigger: Configuring a binder class name that is not on the classpath (ClassNotFoundException), has no no-arg constructor, whose constructor or init(prefix, props) throws, or a typo in the binder property value.

Common situations: Renaming/moving a Binder class without updating the properties file; missing dependency jar at runtime; a Binder's init throwing because required properties are absent.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/time/Options.java:114

      nBinders = PropertiesUtils.getInt(props, name + ".binders", 0);
      binderClasses = new String[nBinders];
      for (int i = 0; i < nBinders; ++i) {
        String binderPrefix = name + ".binder." + (i + 1);
        binderClasses[i] = props.getProperty(binderPrefix);
      }
    }
    if (nBinders > 0 && System.getProperty("STS") == null) {
      binders = new Env.Binder[nBinders];
      for (int i = 0; i < nBinders; i++) {
        int bi = i+1;
        String binderPrefix = name + ".binder." + bi;
        try {
          Class<Env.Binder> binderClass = (Class<Env.Binder>) Class.forName(binderClasses[i]);
          binderPrefix = binderPrefix + '.';
          binders[i] = binderClass.getDeclaredConstructor().newInstance();
          binders[i].init(binderPrefix, props);
        } catch (Exception ex) {
          throw new RuntimeException("Error initializing binder " + bi, ex);
        }
      }
    }
  }
}

View on GitHub (pinned to 1b7edd19c4)