pentaho/pentaho-kettle · error · InstanceCreationException

Unable to instantiate object for

Error message

Unable to instantiate object for 

What it means

The catch block of constructSpoonJobDelegate converts every Exception — NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException — into InstanceCreationException 'Unable to instantiate object for <jobDelegateClass>' without chaining the cause. Hitting this message means reflective construction of the configured (or default) SpoonJobDelegate failed for any of those reasons and the underlying reason was discarded.

Solutions

  1. Pass the caught exception e (and e.getCause()) into the InstanceCreationException to expose the root cause
  2. Make the delegate class public, concrete, with a public single-arg (Spoon) constructor
  3. Check the delegate's constructor body for exceptions thrown during initialization
  4. Test construction in isolation: new MyDelegate(spoon) directly to see the raw failure

Example fix

// before
catch ( Exception e ) {
  throw new InstanceCreationException( "Unable to instantiate object for " + jobDelegateClass, e );
}
// after (already chains e, but ensure callers log getCause)
catch ( InvocationTargetException e ) {
  throw new InstanceCreationException( "Unable to instantiate object for " + jobDelegateClass, e.getCause() );
}
Defensive patterns

Strategy: try-catch

Validate before calling

// verify delegate is constructible before relying on the registry
Object test = jobDelegateClass.getConstructor(Spoon.class).newInstance(spoon); // in test/bootstrap code only

Type guard

boolean isConcreteWithSpoonCtor(Class<?> c) {
  try {
    return !c.isInterface() && !java.lang.reflect.Modifier.isAbstract(c.getModifiers())
      && java.lang.reflect.Modifier.isPublic(c.getConstructor(Spoon.class).getModifiers());
  } catch (NoSuchMethodException e) { return false; }
}

Try / catch

try {
  SpoonDelegate d = registry.constructSpoonJobDelegate(spoon);
} catch (InstanceCreationException e) {
  // cause is not chained in older code; re-verify manually
  log.error("Job delegate instantiation failed for " + jobDelegateClass, e);
  SpoonDelegate d = new SpoonJobDelegate(spoon);
}

Prevention

When it happens

Trigger: jobDelegateClass is abstract or an interface (InstantiationException), its (Spoon) constructor is not public (IllegalAccessException), getConstructor finds no match (NoSuchMethodException), or the constructor throws during newInstance (InvocationTargetException).

Common situations: Custom delegate constructor dereferences spoon internals that are not yet initialized; class not visible to the classloader (plugin classloader mismatch); upgrade changed Spoon's constructor usage the delegate relied on.

Related errors


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

Appendix: source

Thrown at ui/src/main/java/org/pentaho/di/ui/spoon/delegates/SpoonDelegateRegistry.java:74

  public SpoonDelegate constructSpoonJobDelegate( Spoon spoon ) throws InstanceCreationException {
    try {
      if ( jobDelegateClass == null ) {
        Constructor<?> constructor = DEFAULT_SPOONJOBDELEGATE_CLASS.getConstructor( Spoon.class );
        if ( constructor != null ) {
          return (SpoonDelegate) constructor.newInstance( spoon );
        } else {
          throw new InstanceCreationException( "Unable to get the constructor for " + jobDelegateClass );
        }
      }
      Constructor<?> constructor = jobDelegateClass.getConstructor( Spoon.class );
      if ( constructor != null ) {
        return (SpoonDelegate) constructor.newInstance( spoon );
      } else {
        throw new InstanceCreationException( "Unable to get the constructor for " + jobDelegateClass );
      }
    } catch ( Exception e ) {
      throw new InstanceCreationException( "Unable to instantiate object for " + jobDelegateClass, e );
    }
  }

  public SpoonDelegate constructSpoonTransDelegate( Spoon spoon ) throws InstanceCreationException {
    try {
      if ( transDelegateClass == null ) {
        Constructor<?> constructor = DEFAULT_SPOONTRANSDELEGATE_CLASS.getConstructor( Spoon.class );
        if ( constructor != null ) {
          return (SpoonDelegate) constructor.newInstance( spoon );
        } else {
          throw new InstanceCreationException( "Unable to get the constructor for " + transDelegateClass );
        }
      }
      Constructor<?> constructor = transDelegateClass.getConstructor( Spoon.class );
      if ( constructor != null ) {
        return (SpoonDelegate) constructor.newInstance( spoon );
      } else {
        throw new InstanceCreationException( "Unable to get the constructor for " + transDelegateClass );

View on GitHub (pinned to f3058517a1)