languagetool-org/languagetool · error · RuntimeException

Could not find filter class: '${className}' - make sure to u

Error message

Could not find filter class: '${className}' - make sure to use a fully qualified class name like 'org.languagetool.rules.MyFilter'

What it means

Class-loading failure in RegexRuleFilterCreator.getFilter: JLanguageTool's class broker could not load the class name given in the rule's <filter> attribute, usually because the name is misspelled or not fully qualified. The input at fault is the class name string in the XML rule.

Source

Thrown at languagetool-core/src/main/java/org/languagetool/rules/patterns/RegexRuleFilterCreator.java:57

        throw new RuntimeException("Constructor of filter class '"
                + className + "' must have exactly one constructor, but it has " + constructors.length);
      }
      Constructor<?> constructor = constructors[0];
      try {
        if (constructor.getParameterTypes().length != 0) {
          throw new RuntimeException("Constructor of filter class '" + className + "' must not have arguments: " + constructor);
        }
        Object filter = constructor.newInstance();
        if (filter instanceof RegexRuleFilter) {
          return (RegexRuleFilter) filter;
        } else {
          throw new RuntimeException("Filter class '" + className + "' must implement interface " + RegexRuleFilter.class.getSimpleName());
        }
      } catch (Exception e) {
        throw new RuntimeException("Could not create filter class using constructor " + constructor, e);
      }
    } catch (ClassNotFoundException e) {
      throw new RuntimeException("Could not find filter class: '"
              + className + "' - make sure to use a fully qualified class name like 'org.languagetool.rules.MyFilter'");
    }
  }
 
}

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Use a fully qualified class name in the <filter class="..."> attribute, e.g. org.languagetool.rules.MyFilter
  2. Verify the filter class actually exists on the classpath and the spelling matches exactly
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at languagetool-core/src/main/java/org/languagetool/rules/patterns/RegexRuleFilterCreator.java:57 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06). Data as JSON: /api/errors/33a3b1a55cbbd7c0. Report an issue: GitHub.