{"record":{"id":"c55ad4a433b3d856","repo":"pentaho/pentaho-kettle","slug":"the-addrtype-name-value-pair-was-not-found-in-the-reference","errorCode":null,"errorMessage":"The '\" + addrType + \"' name/value pair was not found in the Reference object. The reference Object is \" + ref.toString()","messagePattern":"The '\" \\+ addrType \\+ \"' name/value pair was not found in the Reference object\\. The reference Object is \" \\+ ref\\.toString\\(\\)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/database/util/DecryptingDataSourceFactory.java","lineNumber":71,"sourceCode":"  private void replace( final int idx, final String refType, final String newValue, final Reference ref ) {\n    ref.remove( idx );\n    ref.add( idx, new StringRefAddr( refType, newValue ) );\n  }\n\n  private String decrypt( final int idx, final Reference ref ) throws PasswordEncoderException, XmlParseException {\n    return Encr.getInstance().decryptPasswordOptionallyEncrypted( ref.get( idx ).getContent().toString() );\n  }\n\n  private int find( final String addrType, final Reference ref ) {\n    final Enumeration enu = ref.getAll();\n    for ( int i = 0; enu.hasMoreElements(); i++ ) {\n      final RefAddr addr = (RefAddr) enu.nextElement();\n      if ( addr.getType().compareTo( addrType ) == 0 ) {\n        return i;\n      }\n    }\n\n    throw new IllegalArgumentException(\n      \"The '\" + addrType + \"' name/value pair was not found in the Reference object. The reference Object is\"\n        + \" \" + ref.toString() );\n  }\n}\n","sourceCodeStart":53,"sourceCodeEnd":76,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/database/util/DecryptingDataSourceFactory.java#L53-L76","documentation":"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).","triggerScenarios":"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).","commonSituations":"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.","solutions":["Compare the printed Reference in the message to the addrType requested; add the missing RefAddr when constructing the Reference.","Ensure the factory version matches the code that binds the datasource (field names must match exactly, case-sensitive).","Re-create the datasource binding through the supported configuration path instead of hand-building the Reference.","Catch IllegalArgumentException and validate required reference attributes before lookup."],"exampleFix":"// before\nReference ref = new Reference( DecryptingDataSource.class.getName() );\nref.add( new StringRefAddr( \"user\", \"sa\" ) ); // password addr missing\n// after\nref.add( new StringRefAddr( \"user\", \"sa\" ) );\nref.add( new StringRefAddr( \"password\", \"Encrypted ...\" ) );","handlingStrategy":"validation","validationCode":"// verify required RefAddr types exist before resolving\nSet<String> types = new HashSet<>();\nfor ( Enumeration<RefAddr> en = ref.getAll(); en.hasMoreElements(); )\n  types.add( en.nextElement().getType() );\nif ( !types.contains( \"password\" ) ) throw new IllegalStateException( \"Reference missing 'password' addr\" );","typeGuard":null,"tryCatchPattern":"try {\n  ds = (DataSource) factory.getObjectInstance( ref, name, ctx, env );\n} catch ( IllegalArgumentException e ) {\n  throw new IllegalStateException( \"Datasource Reference missing required property; rebind the datasource\", e );\n}","preventionTips":["Always add all required RefAddr entries (user, password, driver, url) when building References","Use the same factory version that binds the datasource","Rebind datasources through the supported tooling rather than manual Reference construction","Log the Reference contents on failure (the message already includes ref.toString())"],"tags":["jndi","reference","missing-property"],"backgroundTag":"missing-required-config-field","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}