pentaho/pentaho-kettle · error · RuntimeException

RulesData.Error.CompileDRL

RulesData.Error.CompileDRL

Error message

RulesData.Error.CompileDRL

What it means

RulesAccumulatorData.initializeRules compiles the DRL rule string for the Drools step. If a rule file path is configured but the file does not exist, the FileInputStream constructor throws FileNotFoundException, which is rethrown as a RuntimeException with RulesData.Error.CompileDRL, aborting rule initialization.

Solutions

  1. Correct the rule file path in the step dialog or use an absolute path valid on the executing node
  2. Embed the rules as a string in the step instead of referencing a file
  3. Verify the file exists and is readable at runtime on every execution node

Example fix

// before
String ruleFilePath = "/opt/rules/old_name.drl"; // missing
// after
String ruleFilePath = "/opt/rules/accumulate_rules.drl"; // existing file
new java.io.File(ruleFilePath).exists(); // verify before run
Defensive patterns

Strategy: validation

Validate before calling

File f = new File(ruleFilePath);
if (!f.isFile() || !f.canRead()) throw new IllegalArgumentException("Rule file missing/unreadable: " + ruleFilePath);

Try / catch

try { data.initializeRules(...); } catch (RuntimeException e) { if (e.getMessage().contains("CompileDRL")) { logError("Check the rule file path"); } }

Prevention

When it happens

Trigger: The step is configured to load rules from a file whose path does not exist (or is not readable) at execution time, so new FileInputStream(ruleFilePath) throws FileNotFoundException.

Common situations: Moving transformations between environments where the absolute rule file path differs; rule file deleted or renamed; wrong working directory for a relative path; missing mount on a cluster node.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/7bf599edd92cb7eb. Report an issue: GitHub.

Appendix: source

Thrown at plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesAccumulatorData.java:98

  public void initializeRules() {

    // To ensure the plugin classloader use for dependency resolution
    ClassLoader orig = Thread.currentThread().getContextClassLoader();
    ClassLoader loader = getClass().getClassLoader();
    Thread.currentThread().setContextClassLoader( loader );
    KieServices kieServices = KieServices.Factory.get();
    KieFileSystem kfs = kieServices.newKieFileSystem();
    String internalFilePath = "src/main/resources/kettle.drl";

    if ( ruleString != null ) {
      kfs.write( internalFilePath, ruleString );
    } else {
      try {
        FileInputStream fis = new FileInputStream( ruleFilePath );
        kfs.write( internalFilePath, kieServices.getResources().newInputStreamResource( fis ) );
      } catch ( FileNotFoundException e ) {
        throw new RuntimeException( BaseMessages.getString( PKG, "RulesData.Error.CompileDRL" ) );
      }
    }
    KieBuilder kieBuilder = kieServices.newKieBuilder( kfs ).buildAll();
    Results results = kieBuilder.getResults();

    if ( results.hasMessages( Message.Level.ERROR ) ) {
      System.out.println( results.getMessages() );
      throw new RuntimeException( BaseMessages.getString( PKG, "RulesData.Error.CompileDRL" ) );
    }

    KieContainer kieContainer = kieServices.newKieContainer( kieServices.getRepository().getDefaultReleaseId() );
    kieBase = kieContainer.getKieBase();

    // reset classloader back to original
    Thread.currentThread().setContextClassLoader( orig );
  }

  public void initializeInput( RowMetaInterface _inputRowMeta ) {

View on GitHub (pinned to f3058517a1)