pentaho/pentaho-kettle · error · IllegalArgumentException

The '" + addrType + "' name/value pair was not found in the…

Error message

The '" + addrType + "' name/value pair was not found in the Reference object. The reference Object is " + ref.toString()

What it means

DecryptingDataSourceFactory's helper (find, used by idx) walks a JNDI Reference's RefAddr entries looking for one whose type equals addrType; if none matches it throws IllegalArgumentException listing the missing type and the full Reference contents. It means the Reference bound in JNDI is missing a required property (e.g. user, password, driver, url).

Solutions

  1. Compare the printed Reference in the message to the addrType requested; add the missing RefAddr when constructing the Reference.
  2. Ensure the factory version matches the code that binds the datasource (field names must match exactly, case-sensitive).
  3. Re-create the datasource binding through the supported configuration path instead of hand-building the Reference.
  4. Catch IllegalArgumentException and validate required reference attributes before lookup.

Example fix

// before
Reference ref = new Reference( DecryptingDataSource.class.getName() );
ref.add( new StringRefAddr( "user", "sa" ) ); // password addr missing
// after
ref.add( new StringRefAddr( "user", "sa" ) );
ref.add( new StringRefAddr( "password", "Encrypted ..." ) );
Defensive patterns

Strategy: validation

Validate before calling

// verify required RefAddr types exist before resolving
Set<String> types = new HashSet<>();
for ( Enumeration<RefAddr> en = ref.getAll(); en.hasMoreElements(); )
  types.add( en.nextElement().getType() );
if ( !types.contains( "password" ) ) throw new IllegalStateException( "Reference missing 'password' addr" );

Try / catch

try {
  ds = (DataSource) factory.getObjectInstance( ref, name, ctx, env );
} catch ( IllegalArgumentException e ) {
  throw new IllegalStateException( "Datasource Reference missing required property; rebind the datasource", e );
}

Prevention

When it happens

Trigger: Resolving a DecryptingDataSource from a JNDI Reference via getObjectInstance when the Reference lacks the RefAddr the factory asks for (calling find/idx with an addrType absent from the Reference).

Common situations: Datasource Reference created by a different factory/version that omits fields, hand-built Reference objects missing put() calls for required properties, container rewriting the binding and dropping attributes.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/database/util/DecryptingDataSourceFactory.java:71

  private void replace( final int idx, final String refType, final String newValue, final Reference ref ) {
    ref.remove( idx );
    ref.add( idx, new StringRefAddr( refType, newValue ) );
  }

  private String decrypt( final int idx, final Reference ref ) throws PasswordEncoderException, XmlParseException {
    return Encr.getInstance().decryptPasswordOptionallyEncrypted( ref.get( idx ).getContent().toString() );
  }

  private int find( final String addrType, final Reference ref ) {
    final Enumeration enu = ref.getAll();
    for ( int i = 0; enu.hasMoreElements(); i++ ) {
      final RefAddr addr = (RefAddr) enu.nextElement();
      if ( addr.getType().compareTo( addrType ) == 0 ) {
        return i;
      }
    }

    throw new IllegalArgumentException(
      "The '" + addrType + "' name/value pair was not found in the Reference object. The reference Object is"
        + " " + ref.toString() );
  }
}

View on GitHub (pinned to f3058517a1)