{"record":{"id":"83907b158a171ac2","repo":"pentaho/pentaho-kettle","slug":"unable-to-get-the-constructor-for","errorCode":null,"errorMessage":"Unable to get the constructor for ","messagePattern":"Unable to get the constructor for ","errorType":"exception","errorClass":"UIObjectCreationException","httpStatus":null,"severity":"error","filePath":"ui/src/main/java/org/pentaho/di/ui/repository/repositoryexplorer/model/UIObjectRegistry.java","lineNumber":128,"sourceCode":"        return (UIJob) constructor.newInstance( rc, parent, rep );\n      } else {\n        throw new UIObjectCreationException( \"Unable to get the constructor for \" + jobClass );\n      }\n    } catch ( Exception e ) {\n      throw new UIObjectCreationException( \"Unable to instantiate object for \" + jobClass );\n    }\n  }\n\n  public UITransformation constructUITransformation( RepositoryElementMetaInterface rc,\n    UIRepositoryDirectory parent, Repository rep ) throws UIObjectCreationException {\n    try {\n      Constructor<?> constructor =\n        transClass.getConstructor(\n          RepositoryElementMetaInterface.class, UIRepositoryDirectory.class, Repository.class );\n      if ( constructor != null ) {\n        return (UITransformation) constructor.newInstance( rc, parent, rep );\n      } else {\n        throw new UIObjectCreationException( \"Unable to get the constructor for \" + transClass );\n      }\n    } catch ( Exception e ) {\n      throw new UIObjectCreationException( \"Unable to instantiate object for \" + transClass );\n    }\n  }\n\n  public UIRepositoryDirectory constructUIRepositoryDirectory( RepositoryDirectoryInterface rd,\n    UIRepositoryDirectory uiParent, Repository rep ) throws UIObjectCreationException {\n    try {\n      Constructor<?> constructor =\n        dirClass.getConstructor(\n          RepositoryDirectoryInterface.class, UIRepositoryDirectory.class, Repository.class );\n      if ( constructor != null ) {\n        return (UIRepositoryDirectory) constructor.newInstance( rd, uiParent, rep );\n      } else {\n        throw new UIObjectCreationException( \"Unable to get the constructor for \" + dirClass );\n      }\n    } catch ( Exception e ) {","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/ui/src/main/java/org/pentaho/di/ui/repository/repositoryexplorer/model/UIObjectRegistry.java#L110-L146","documentation":"UIObjectRegistry.constructUITransformation() looks up a Constructor<init>(RepositoryElementMetaInterface, UIRepositoryDirectory, Repository) on the registered transformation class via getConstructor(). If getConstructor() throws NoSuchMethodException, the code throws UIObjectCreationException 'Unable to get the constructor for ' + transClass. (The index's message text corresponds to the sibling instantiate branch, but this throw site fires when the required constructor signature is missing.)","triggerScenarios":"Registering a custom UITransformation subclass that does not declare a public constructor taking (RepositoryElementMetaInterface, UIRepositoryDirectory, Repository), so getConstructor() finds nothing.","commonSituations":"Custom registry extension after a PDI upgrade changed constructor signatures; class written against an older UITransformation API; typo'd or non-public constructor in a custom class.","solutions":["Add/fix a public constructor with the exact signature (RepositoryElementMetaInterface, UIRepositoryDirectory, Repository) in the registered class","Recompile the custom class against the current PDI UI library version","Remove the custom registration so the default UITransformation is used","Check that getConstructor's parameter types exactly match, including the Repository interface (not a concrete class)"],"exampleFix":"// before\npublic MyUITransformation( RepositoryElementMetaInterface rc, UIRepositoryDirectory parent ) { ... }\n// after\npublic MyUITransformation( RepositoryElementMetaInterface rc, UIRepositoryDirectory parent, Repository rep ) { ... }","handlingStrategy":"type-guard","validationCode":"try {\n  transClass.getConstructor(RepositoryElementMetaInterface.class, UIRepositoryDirectory.class, Repository.class);\n} catch (NoSuchMethodException e) {\n  throw new IllegalStateException(transClass + \" lacks required UI constructor\", e);\n}","typeGuard":"boolean hasUITransConstructor(Class<?> c) {\n  try { c.getConstructor(RepositoryElementMetaInterface.class, UIRepositoryDirectory.class, Repository.class); return true; }\n  catch (NoSuchMethodException e) { return false; }\n}","tryCatchPattern":"try { UITransformation t = registry.constructUITransformation(rc, parent, rep); } catch (UIObjectCreationException e) { log.error(\"Constructor missing on \" + e.getMessage(), e); UITransformation t = new UITransformation(rc, parent, rep); }","preventionTips":["Compile custom UITransformation subclasses against the exact PDI version in use","Always include the full 3-argument public constructor in registry classes","Run a startup smoke test that constructs each registered class","Avoid parameter type substitutions (concrete class for interface) in constructors"],"tags":["reflection","constructor","kettle","registry","nosuchmethod"],"backgroundTag":"invalid-constructor-argument","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"}