{"record":{"id":"b4eff701fa45ceb4","repo":"JetBrains/intellij-community","slug":"error-creating-evaluation-class-loader","errorCode":null,"errorMessage":"Error creating evaluation class loader: ","messagePattern":"Error creating evaluation class loader: ","errorType":"exception","errorClass":"EvaluateException","httpStatus":null,"severity":"error","filePath":"java/debugger/impl/src/com/intellij/debugger/impl/ClassLoadingUtils.java","lineNumber":43,"sourceCode":"\nimport static com.intellij.debugger.impl.DebuggerUtilsEx.enableCollection;\n\npublic final class ClassLoadingUtils {\n  private ClassLoadingUtils() { }\n\n  public static ClassLoaderReference getClassLoader(EvaluationContext context, DebugProcess process) throws EvaluateException {\n    try {\n      ClassType loaderClass = (ClassType)process.findClass(context, \"java.security.SecureClassLoader\", context.getClassLoader());\n      Method ctorMethod = DebuggerUtils.findMethod(loaderClass, JVMNameUtil.CONSTRUCTOR_NAME, \"(Ljava/lang/ClassLoader;)V\");\n      return context.computeAndKeep(() -> (ClassLoaderReference)((DebugProcessImpl)process)\n        .newInstance(context, loaderClass, Objects.requireNonNull(ctorMethod), Collections.singletonList(context.getClassLoader()),\n                     MethodImpl.SKIP_ASSIGNABLE_CHECK, true));\n    }\n    catch (VMDisconnectedException e) {\n      throw e;\n    }\n    catch (Exception e) {\n      throw new EvaluateException(\"Error creating evaluation class loader: \" + e, e);\n    }\n  }\n\n  public static void defineClass(String name,\n                                 byte[] bytes,\n                                 EvaluationContextImpl context,\n                                 ClassLoaderReference classLoader) throws EvaluateException {\n    try {\n      VirtualMachineProxyImpl proxy = context.getVirtualMachineProxy();\n      Method defineMethod =\n        DebuggerUtils.findMethod(classLoader.referenceType(), \"defineClass\", \"(Ljava/lang/String;[BII)Ljava/lang/Class;\");\n      StringReference nameString = DebuggerUtilsEx.mirrorOfString(name, context);\n      ArrayReference byteArray = DebuggerUtilsEx.mirrorOfByteArray(bytes, context);\n      try {\n        context.getDebugProcess().invokeInstanceMethod(context, classLoader, Objects.requireNonNull(defineMethod),\n                                                       Arrays.asList(nameString,\n                                                                     byteArray,\n                                                                     proxy.mirrorOf(0),","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/debugger/impl/src/com/intellij/debugger/impl/ClassLoadingUtils.java#L25-L61","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Check the debuggee is alive and healthy (not OOMing) — inspect its logs","Disable the SecurityManager in the debuggee or grant it permission to create class loaders","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","Retry evaluation after the debuggee settles (startup classloader churn can be transient)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before triggering compiling evaluation\nif (!process.isAttached()) throw new EvaluateException(\"debuggee not attached\");\nClassType loader = (ClassType)process.findClass(context, \"java.security.SecureClassLoader\", context.getClassLoader());\nif (loader == null) { /* fall back to non-compiling evaluation mode */ }","typeGuard":null,"tryCatchPattern":"try {\n  ClassLoaderReference cl = ClassLoadingUtils.getClassLoader(context, process);\n} catch (EvaluateException e) {\n  // VMDisconnectedException rethrow is fine here; otherwise degrade to non-compiling evaluator\n} \n/* note: VMDisconnectedException is rethrown unwrapped by getClassLoader */","preventionTips":["Ensure the debuggee has heap headroom and no SecurityManager blocking classloader creation","Keep a fallback evaluation mode configured for restricted debuggees","Confirm the debuggee is fully started before evaluating complex fragments"],"tags":["debugger","class-loading","evaluation","classloader"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}