pentaho/pentaho-kettle · error · KettleException

Unexpected error during classloader creation

Error message

Unexpected error during classloader creation

What it means

Const.getClassLoader() creates an empty URLClassLoader used for JavaScript utility scopes. Although the URL array is empty, any unexpected Exception during construction is wrapped in KettleException 'Unexpected error during classloader creation'. This is rare and usually indicates a JVM/classloader infrastructure problem.

Solutions

  1. Check JVM security policy / SecurityManager permissions for createClassLoader
  2. Review the cause chain (KettleException wraps the original exception) for the underlying classloader failure
  3. Use the current thread's context classloader as a fallback instead of creating a new URLClassLoader

Example fix

// before
ClassLoader cl = Const.getClassLoader();
// after
try {
  ClassLoader cl = Const.getClassLoader();
} catch (KettleException e) {
  ClassLoader cl = Thread.currentThread().getContextClassLoader();
}
Defensive patterns

Strategy: try-catch

Try / catch

try { ClassLoader cl = Const.getClassLoader(); } catch (KettleException e) { logger.warn("Classloader creation failed, using context classloader", e); ClassLoader cl = Thread.currentThread().getContextClassLoader(); }

Prevention

When it happens

Trigger: Calling Const.getClassLoader() when JVM security policy or classloader state prevents creating a URLClassLoader (e.g. SecurityException under a restrictive SecurityManager, or classloader creation failing in an exotic container).

Common situations: Running Kettle in hardened environments with strict SecurityManager policies; embedding Kettle in an application server with unusual classloader delegation; modular (JPMS) classpath setups.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/Const.java:3560

   * @see org.pentaho.di.core.util.Utils#isEmpty(List)
   */
  @Deprecated
  public static boolean isEmpty( List<?> list ) {
    return Utils.isEmpty( list );
  }

  /**
   * @return a new ClassLoader
   */
  public static ClassLoader createNewClassLoader() throws KettleException {
    try {
      // Nothing really in URL, everything is in scope.
      URL[] urls = new URL[] {};
      URLClassLoader ucl = new URLClassLoader( urls );

      return ucl;
    } catch ( Exception e ) {
      throw new KettleException( "Unexpected error during classloader creation", e );
    }
  }

  /**
   * Utility class for use in JavaScript to create a new byte array. This is surprisingly difficult to do in JavaScript.
   *
   * @return a new java byte array
   */
  public static byte[] createByteArray( int size ) {
    return new byte[size];
  }

  /**
   * Sets the first character of each word in upper-case.
   *
   * @param string
   *          The strings to convert to initcap
   * @return the input string but with the first character of each word converted to upper-case.

View on GitHub (pinned to f3058517a1)