pentaho/pentaho-kettle · error · UIObjectCreationException

Unable to instantiate object for

Error message

Unable to instantiate object for ${repositoryRoleClass}

What it means

This is the generic catch-all of constructUIRepositoryRole: any exception while looking up or invoking the IRole constructor (NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException) is rethrown as UIObjectCreationException('Unable to instantiate object for <class>').

Solutions

  1. Inspect the cause of this exception (it swallows details) — check logs for the underlying NoSuchMethodException or InvocationTargetException
  2. Ensure the registered class is concrete, public, and has a public constructor taking IRole
  3. Make the constructor body defensive so it cannot throw on valid IRole inputs
  4. Align plugin/class versions with the PDI EE repository client version

Example fix

// before
} catch ( Exception e ) {
  throw new UIObjectCreationException( "Unable to instantiate object for " + repositoryRoleClass );
}
// after
} catch ( Exception e ) {
  throw new UIObjectCreationException( "Unable to instantiate object for " + repositoryRoleClass, e );
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!java.lang.reflect.Modifier.isAbstract(cls.getModifiers()) && java.util.Arrays.stream(cls.getConstructors()).anyMatch(c -> c.getParameterCount() == 1 && IRole.class.isAssignableFrom(c.getParameterTypes()[0]))) { /* safe to construct */ }

Type guard

static boolean isInstantiableRole(Class<?> cls) {
  return !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);
}

Try / catch

try {
  IUIRole uiRole = registry.constructUIRepositoryRole(role);
} catch (UIObjectCreationException e) {
  log.error("Cannot instantiate " + cls + ": check constructor accepts IRole", e);
}

Prevention

When it happens

Trigger: Calling constructUIRepositoryRole when the registered class has no matching constructor (NoSuchMethodException), is abstract/an interface (InstantiationException), its constructor is inaccessible (IllegalAccessException), or the constructor body throws (InvocationTargetException).

Common situations: Custom IUIRole implementations that throw during construction; abstract classes registered by mistake; classloader/plugin version mismatches in PDI EE repositories where the role class was compiled against a different IRole API.

Related errors


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

Appendix: source

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

  }

  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)