JetBrains/intellij-community · error · EvaluateException

Error creating evaluation class loader:

Error message

Error creating evaluation class loader: 

What it means

Thrown by ClassLoadingUtils.getClassLoader when the debugger fails to construct a java.security.SecureClassLoader instance inside the debuggee VM via JDI newInstance. This class loader is the foundation for loading the debugger's generated evaluation helper classes, so any failure here aborts evaluation setup. All non-disconnect exceptions are wrapped with this generic message.

Source

Thrown at java/debugger/impl/src/com/intellij/debugger/impl/ClassLoadingUtils.java:43

import static com.intellij.debugger.impl.DebuggerUtilsEx.enableCollection;

public final class ClassLoadingUtils {
  private ClassLoadingUtils() { }

  public static ClassLoaderReference getClassLoader(EvaluationContext context, DebugProcess process) throws EvaluateException {
    try {
      ClassType loaderClass = (ClassType)process.findClass(context, "java.security.SecureClassLoader", context.getClassLoader());
      Method ctorMethod = DebuggerUtils.findMethod(loaderClass, JVMNameUtil.CONSTRUCTOR_NAME, "(Ljava/lang/ClassLoader;)V");
      return context.computeAndKeep(() -> (ClassLoaderReference)((DebugProcessImpl)process)
        .newInstance(context, loaderClass, Objects.requireNonNull(ctorMethod), Collections.singletonList(context.getClassLoader()),
                     MethodImpl.SKIP_ASSIGNABLE_CHECK, true));
    }
    catch (VMDisconnectedException e) {
      throw e;
    }
    catch (Exception e) {
      throw new EvaluateException("Error creating evaluation class loader: " + e, e);
    }
  }

  public static void defineClass(String name,
                                 byte[] bytes,
                                 EvaluationContextImpl context,
                                 ClassLoaderReference classLoader) throws EvaluateException {
    try {
      VirtualMachineProxyImpl proxy = context.getVirtualMachineProxy();
      Method defineMethod =
        DebuggerUtils.findMethod(classLoader.referenceType(), "defineClass", "(Ljava/lang/String;[BII)Ljava/lang/Class;");
      StringReference nameString = DebuggerUtilsEx.mirrorOfString(name, context);
      ArrayReference byteArray = DebuggerUtilsEx.mirrorOfByteArray(bytes, context);
      try {
        context.getDebugProcess().invokeInstanceMethod(context, classLoader, Objects.requireNonNull(defineMethod),
                                                       Arrays.asList(nameString,
                                                                     byteArray,
                                                                     proxy.mirrorOf(0),

View on GitHub (pinned to be881553f2)

Solutions

  1. Check the debuggee is alive and healthy (not OOMing) — inspect its logs
  2. Disable the SecurityManager in the debuggee or grant it permission to create class loaders
  3. Switch the debugger to a non-compiling evaluation mode (Settings > Debugger > Java > Evaluate in fraction mode / disable 'compiling' evaluator) so helper class loading is not required
  4. Retry evaluation after the debuggee settles (startup classloader churn can be transient)
Defensive patterns

Strategy: try-catch

Validate before calling

// before triggering compiling evaluation
if (!process.isAttached()) throw new EvaluateException("debuggee not attached");
ClassType loader = (ClassType)process.findClass(context, "java.security.SecureClassLoader", context.getClassLoader());
if (loader == null) { /* fall back to non-compiling evaluation mode */ }

Try / catch

try {
  ClassLoaderReference cl = ClassLoadingUtils.getClassLoader(context, process);
} catch (EvaluateException e) {
  // VMDisconnectedException rethrow is fine here; otherwise degrade to non-compiling evaluator
} 
/* note: VMDisconnectedException is rethrown unwrapped by getClassLoader */

Prevention

When it happens

Trigger: Evaluating an expression in 'compiling' mode triggers getClassLoader: findClass('java.security.SecureClassLoader') then newInstance invoking the (ClassLoader) constructor with the context's loader; any failure (ClassNotLoadedException, InvocationException from the constructor, security manager denial, InvalidTypeException) except VMDisconnectedException becomes EvaluateException('Error creating evaluation class loader: ' + e).

Common situations: Debuggee under a SecurityManager that blocks class loader creation; debuggee OOM or GC pressure preventing allocation; class loader hierarchy issues in application servers; debuggee crashed/disconnecting mid-evaluation.

Related errors


AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14). Data as JSON: /api/errors/b4eff701fa45ceb4. Report an issue: GitHub.