Hi, Spring Boot Team! First, describe my question: Spring Boot version 3.2.8, and I continuously receive NoClassDefFoundError in my java services. But strangely, some pods are normal, some pods can’t load org/springframework/aop/framework/AdvisedSupport$MethodCacheKey class. I'm every sure this class file is in the correct position in Spring Boot FatJar(/!BOOT-INF/lib/spring-aop-6.1.11.jar!/).

2025-08-06 00:28:31.093 [iot-device-simulator-7565776bcb-ldnpp:8008] [] [simulator-task-notify-ordered-0-1] ERROR com.xxx.xxx.xxx.XxxApplication - Uncaught exception in thread: Thread[simulator-task-notify-ordered-0-1,5,main], classloader: org.springframework.boot.loader.launch.LaunchedClassLoader@2dda6444ex: 
 java.lang.NoClassDefFoundError: org/springframework/aop/framework/AdvisedSupport$MethodCacheKey
    at org.springframework.aop.framework.AdvisedSupport.getInterceptorsAndDynamicInterceptionAdvice(AdvisedSupport.java:494)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
    at jdk.proxy2/jdk.proxy2.$Proxy113.updateGatewayStatus(Unknown Source)

Second, I tried to read Spring Boot class loading mechanism(LaunchedClassLoader), I found something strange in FileDataBlock.fillBuffer() method. Why using RandomAccessFile to read FatJar file after the class loading thread is interrupted? But I'm not sure is this the problem root cause, because many IOException(s) are catched and ignored.

class FileDataBlock implements CloseableDataBlock {

    private void fillBuffer(long position) throws IOException {
        if (Thread.currentThread().isInterrupted()) {
            fillBufferUsingRandomAccessFile(position);
            return;
        }
        try {
            if (this.fileChannelInterrupted) {
                repairFileChannel();
                this.fileChannelInterrupted = false;
            }
            this.buffer.clear();
            this.bufferSize = this.fileChannel.read(this.buffer, position);
            this.bufferPosition = position;
        }
        catch (ClosedByInterruptException ex) {
            this.fileChannelInterrupted = true;
            fillBufferUsingRandomAccessFile(position);
        }
    }

    private void fillBufferUsingRandomAccessFile(long position) throws IOException {
        if (this.randomAccessFile == null) {
            this.randomAccessFile = new RandomAccessFile(this.path.toFile(), "r");
            tracker.openedFileChannel(this.path);
        }
        byte[] bytes = new byte[BUFFER_SIZE];
        this.randomAccessFile.seek(position);
        int len = this.randomAccessFile.read(bytes);
        this.buffer.clear();
        if (len > 0) {
            this.buffer.put(bytes, 0, len);
        }
        this.bufferSize = len;
        this.bufferPosition = position;
    }

If the I/O operations is interrupted by Future.cancel(true), it seems the class loading process is interrupted, and the class can't be loaded forever.

public class FutureTask<V> implements RunnableFuture<V> {

    public boolean cancel(boolean mayInterruptIfRunning) {
        if (!(state == NEW && STATE.compareAndSet
              (this, NEW, mayInterruptIfRunning ? INTERRUPTING : CANCELLED)))
            return false;
        try {    // in case call to interrupt throws exception
            if (mayInterruptIfRunning) {
                try {
                    Thread t = runner;
                    if (t != null)
                    // If this thread is blocked in an I/ O operation upon an InterruptibleChannel then the channel will be closed, the thread's interrupt status will be set, and the thread will receive a java. nio. channels. ClosedByInterruptException.
                        t.interrupt();
                } finally { // final state
                    STATE.setRelease(this, INTERRUPTED);
                }
            }
        } finally {
            finishCompletion();
        }
        return true;
    }

Third, I replaced Future.cancel(true) with Future.cancel(false), it seemed worked. Forgive me, I had tried my best effort to debug this problem. There's no log and I don't know how to repackage spring-boot-maven-plugin, and put the spring-boot-loader classes in the FatJar. Hope to receive your reply!