{"record":{"id":"bc4ab51f070ac4d5","repo":"pentaho/pentaho-kettle","slug":"unexpected-error-during-classloader-creation","errorCode":null,"errorMessage":"Unexpected error during classloader creation","messagePattern":"Unexpected error during classloader creation","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/Const.java","lineNumber":3560,"sourceCode":"   * @see org.pentaho.di.core.util.Utils#isEmpty(List)\n   */\n  @Deprecated\n  public static boolean isEmpty( List<?> list ) {\n    return Utils.isEmpty( list );\n  }\n\n  /**\n   * @return a new ClassLoader\n   */\n  public static ClassLoader createNewClassLoader() throws KettleException {\n    try {\n      // Nothing really in URL, everything is in scope.\n      URL[] urls = new URL[] {};\n      URLClassLoader ucl = new URLClassLoader( urls );\n\n      return ucl;\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unexpected error during classloader creation\", e );\n    }\n  }\n\n  /**\n   * Utility class for use in JavaScript to create a new byte array. This is surprisingly difficult to do in JavaScript.\n   *\n   * @return a new java byte array\n   */\n  public static byte[] createByteArray( int size ) {\n    return new byte[size];\n  }\n\n  /**\n   * Sets the first character of each word in upper-case.\n   *\n   * @param string\n   *          The strings to convert to initcap\n   * @return the input string but with the first character of each word converted to upper-case.","sourceCodeStart":3542,"sourceCodeEnd":3578,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/Const.java#L3542-L3578","documentation":"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.","triggerScenarios":"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).","commonSituations":"Running Kettle in hardened environments with strict SecurityManager policies; embedding Kettle in an application server with unusual classloader delegation; modular (JPMS) classpath setups.","solutions":["Check JVM security policy / SecurityManager permissions for createClassLoader","Review the cause chain (KettleException wraps the original exception) for the underlying classloader failure","Use the current thread's context classloader as a fallback instead of creating a new URLClassLoader"],"exampleFix":"// before\nClassLoader cl = Const.getClassLoader();\n// after\ntry {\n  ClassLoader cl = Const.getClassLoader();\n} catch (KettleException e) {\n  ClassLoader cl = Thread.currentThread().getContextClassLoader();\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { ClassLoader cl = Const.getClassLoader(); } catch (KettleException e) { logger.warn(\"Classloader creation failed, using context classloader\", e); ClassLoader cl = Thread.currentThread().getContextClassLoader(); }","preventionTips":["Avoid running with a restrictive SecurityManager that blocks createClassLoader","Test Kettle embedding in your app-server/modular environment early","Log the wrapped cause to identify the real classloader failure"],"tags":["classloader","jvm","pentaho-kettle"],"backgroundTag":"module-init-failed","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}