pentaho/pentaho-kettle · error · UIObjectCreationException

Unable to get the constructor for

Error message

Unable to get the constructor for ${repositoryRoleClass}

What it means

UIEEObjectRegistery.constructUIRepositoryRole uses reflection to build an IUIRole from an IRole via a constructor taking IRole. Class.getConstructor(IRole.class) throws NoSuchMethodException (never returns null), so the null check is dead code; the message indicates the registered UI role class has no public IRole constructor.

Solutions

  1. Ensure the registered UI role class declares a public constructor accepting IRole (public UIRepositoryRole(IRole role) {...})
  2. Verify DEFAULT_UIREPOSITORYROLE_CLASS / setClass points to UIRepositoryRole (or a valid subclass) and was not changed or left null unexpectedly
  3. Check for plugins or patches that replaced the role class; restore the default class
  4. Note: after getConstructor fails, the generic catch throws 'Unable to instantiate object for ...' — inspect that exception's cause for NoSuchMethodException

Example fix

// before
public class MyUIRole implements IUIRole {
  public MyUIRole() { }
}
// after
public class MyUIRole implements IUIRole {
  public MyUIRole(IRole role) { /* init from role */ }
}
Defensive patterns

Strategy: try-catch

Validate before calling

Class<?> cls = registryClass;
boolean ok = java.lang.reflect.Modifier.isPublic(cls.getModifiers())
  && !cls.isInterface()
  && !java.lang.reflect.Modifier.isAbstract(cls.getModifiers())
  && java.util.Arrays.stream(cls.getConstructors()).anyMatch(c -> c.getParameterCount() == 1 && c.getParameterTypes()[0] == IRole.class);

Type guard

static boolean hasRoleConstructor(Class<?> cls) {
  try { cls.getConstructor(IRole.class); return true; } catch (NoSuchMethodException e) { return false; }
}

Try / catch

try {
  IUIRole uiRole = registry.constructUIRepositoryRole(role);
} catch (UIObjectCreationException e) {
  log.error("Failed to create UI role for " + role, e);
  // fall back to default UIRepositoryRole
}

Prevention

When it happens

Trigger: The class registered via setClass (or DEFAULT_UIREPOSITORYROLE_CLASS) lacks a public constructor accepting IRole, so getConstructor throws NoSuchMethodException before the null check can succeed.

Common situations: Registering a custom UIRepositoryRole subclass that only defines a no-arg or different-arg constructor; class hierarchy changes in Pentaho (PDI) EE plugin upgrades where the IRole constructor signature changed; misconfigured custom role class in the registry.

Related errors


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

Appendix: source

Thrown at plugins/pur/core/src/main/java/org/pentaho/di/ui/repository/pur/repositoryexplorer/UIEEObjectRegistery.java:60

  public void registerUIRepositoryRoleClass( Class<?> repositoryRoleClass ) {
    this.repositoryRoleClass = repositoryRoleClass;
  }

  public Class<?> getRegisteredUIRepositoryRoleClass() {
    return this.repositoryRoleClass;
  }

  public IUIRole constructUIRepositoryRole( IRole role ) throws UIObjectCreationException {
    try {
      if ( repositoryRoleClass == null ) {
        repositoryRoleClass = DEFAULT_UIREPOSITORYROLE_CLASS;
      }
      Constructor<?> constructor = repositoryRoleClass.getConstructor( IRole.class );
      if ( constructor != null ) {
        return (IUIRole) constructor.newInstance( role );
      } else {
        throw new UIObjectCreationException( "Unable to get the constructor for " + repositoryRoleClass );
      }
    } catch ( Exception e ) {
      throw new UIObjectCreationException( "Unable to instantiate object for " + repositoryRoleClass );
    }
  }
}

View on GitHub (pinned to f3058517a1)