pentaho/pentaho-kettle · error · KettleException

Error invoking lifecycle listener

Error message

Error invoking lifecycle listener: {0}

What it means

KettleLifecycleSupport.onEnvironmentInit() invokes each registered KettleLifecycleListener. A listener throwing a LifecycleException marked severe is wrapped into this KettleException with a localized 'Error invoking lifecycle listener: {0}' message. It means environment initialization was aborted by a plugin listener.

Solutions

  1. Read the wrapped LifecycleException cause to identify the failing listener and its complaint
  2. Fix the environment condition the listener validates (missing env var, unreachable resource)
  3. Uninstall/disable the offending plugin if unneeded
  4. Log as non-severe by throwing LifecycleException with severe=false if failure is tolerable

Example fix

// before
throw new LifecycleException(true, "db unreachable"); // severe -> aborts init
// after
throw new LifecycleException(false, "db unreachable"); // logged, init continues
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-validate listener environment before KettleEnvironment.init()
for (KettleLifecycleListener l : ServiceLoader.load(KettleLifecycleListener.class)) {
  try { l.onEnvironmentInit(); } catch (LifecycleException e) { preflightFailures.add(l + ": " + e.getMessage()); }
}

Try / catch

try {
  KettleEnvironment.init();
} catch (KettleException e) {
  if (e.getMessage().startsWith("Error invoking lifecycle listener")) {
    log.error("Plugin lifecycle listener failed init: ", e.getCause());
  } else throw e;
}

Prevention

When it happens

Trigger: Plugin registration adds a listener whose onEnvironmentInit() throws a severe LifecycleException during Kettle environment init (or later when a plugin is added at runtime).

Common situations: Lifecycle listeners validating environment (env vars, licenses, database availability) failing at startup; badly installed plugin.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/core/lifecycle/KettleLifecycleSupport.java:113

  public void onEnvironmentInit() throws KettleException {
    // Execute only once
    if ( initialized.compareAndSet( false, true ) ) {
      for ( KettleLifecycleListener listener : kettleLifecycleListeners.keySet() ) {
        onEnvironmentInit( listener );
      }
    }
  }

  private void onEnvironmentInit( KettleLifecycleListener listener ) throws KettleException {
    // Run only once per listener
    if ( kettleLifecycleListeners.replace( listener, false, true ) ) {
      try {
        listener.onEnvironmentInit();
      } catch ( LifecycleException ex ) {
        String message =
          BaseMessages.getString( PKG, "LifecycleSupport.ErrorInvokingKettleLifecycleListener", listener );
        if ( ex.isSevere() ) {
          throw new KettleException( message, ex );
        }
        // Not a severe error so let's simply log it and continue invoking the others
        LogChannel.GENERAL.logError( message, ex );
      } catch ( Throwable t ) {
        Throwables.propagateIfPossible( t, KettleException.class );
        String message = BaseMessages.getString(
          PKG, "LifecycleSupport.ErrorInvokingKettleLifecycleListener", listener );
        throw new KettleException( message, t );
      }
    }
  }

  public void onEnvironmentShutdown() {
    for ( KettleLifecycleListener listener : kettleLifecycleListeners.keySet() ) {
      try {
        listener.onEnvironmentShutdown();
      } catch ( Throwable t ) {
        // Log the error and continue invoking other listeners

View on GitHub (pinned to f3058517a1)