pentaho/pentaho-kettle · error · KettleException

Error allocating new job

Error message

Error allocating new job: {0}

What it means

Thrown by Job.createJobWithNewClassLoader when reflective instantiation of the Job class fails. Kettle tries to construct a new Job object via the default constructor of jobClass so the job runs in an isolated classloader; any Exception during getDeclaredConstructor().newInstance() is wrapped in a KettleException with this message.

Solutions

  1. Give the Job subclass a public no-arg constructor
  2. Inspect the cause (e.getCause()) to see the actual reflective instantiation failure (InstantiationException, InvocationTargetException, etc.)
  3. Verify the class resolved by jobClass is a concrete instantiable class
  4. Check SecurityManager/module settings if access is being denied

Example fix

// before
class MyJob extends Job { MyJob(JobMeta m) { ... } }
// after
class MyJob extends Job { public MyJob() { ... } public MyJob(JobMeta m) { ... } }
Defensive patterns

Strategy: try-catch

Validate before calling

// before calling
if (java.lang.reflect.Modifier.isAbstract(jobClass.getModifiers()) || jobClass.isInterface()) {
  throw new IllegalArgumentException(jobClass + " is not instantiable");
}
try { jobClass.getDeclaredConstructor(); } catch (NoSuchMethodException e) {
  throw new IllegalArgumentException(jobClass + " lacks a no-arg constructor");
}

Type guard

static boolean isInstantiable(Class<?> c) {
  return !c.isInterface() && !java.lang.reflect.Modifier.isAbstract(c.getModifiers());
}

Try / catch

try {
  Job job = jobEngine.createJobWithNewClassLoader();
} catch (KettleException e) {
  Throwable root = e;
  while (root.getCause() != null) root = root.getCause();
  log.error("Job instantiation failed: " + root.getMessage(), root);
}

Prevention

When it happens

Trigger: Calling createJobWithNewClassLoader when jobClass has no accessible no-arg constructor, the constructor throws, or the class cannot be instantiated (abstract class, interface, reflective access blocked).

Common situations: Custom Job subclasses lacking a public no-arg constructor; running under a SecurityManager or JPMS module that blocks setAccessible; classpath changes that make the resolved class abstract or an interface.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/job/Job.java:351

    } else {
      return jobMeta.getName();
    }
  }

  public static final Job createJobWithNewClassLoader() throws KettleException {
    try {
      // Load the class.
      Class<?> jobClass = Const.createNewClassLoader().loadClass( Job.class.getName() );

      // create the class
      // Try to instantiate this one...
      Job job = (Job) jobClass.getDeclaredConstructor().newInstance();

      // Done!
      return job;
    } catch ( Exception e ) {
      String message = BaseMessages.getString( PKG, "Job.Log.ErrorAllocatingNewJob", e.toString() );
      throw new KettleException( message, e );
    }
  }

  public String getJobname() {
    if ( jobMeta == null ) {
      return null;
    }
    return jobMeta.getName();
  }

  public void setRepository( Repository rep ) {
    this.rep = rep;
  }

  /**
   * Initializes the job's variable space from the appropriate source.
   * <p>
   * Priority order: parentJob > jobMeta > default space.

View on GitHub (pinned to f3058517a1)