ReactorDebugAgent.init 抛出 IllegalStateException

ReactorDebugAgent.init throw IllegalStateException

我正在将应用程序从 JVM 8 升级到 11,但遇到任何问题。我的 SpringBootApplication class 有 ReactorDebugAgent.init();

@SpringBootApplication
@Slf4j
@Import(SwaggerCustomConfig.class)
public class RequisitesApplication {
    public static void main(String[] args) {
        ReactorDebugAgent.init();
        SpringApplication.run(RequisitesApplication.class, args);
    }
}

并且当我尝试 运行 应用程序时,捕获 IllegalStateException:

Exception in thread "main" java.lang.IllegalStateException: Could not self-attach to current VM using external process
    at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.installExternal(ByteBuddyAgent.java:695)
    at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:626)
    at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:606)
    at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:558)
    at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:535)
    at reactor.tools.agent.ReactorDebugAgent.init(ReactorDebugAgent.java:56)
    at ru.gazprombank.omni.pcidss.RequisitesApplication.main(RequisitesApplication.java:23)

嗯,当我深入堆栈跟踪时,我发现,然后这个异常在 ByteBuddyAgent.class:

if ((new ProcessBuilder(new String[]{System.getProperty("java.home") + File.separatorChar + "bin" + File.separatorChar + (System.getProperty("os.name", "").toLowerCase(Locale.US).contains("windows") ? "java.exe" : "java"), "-cp", classPath.toString(), Attacher.class.getName(), externalAttachment.getVirtualMachineType(), processId, quote(agent.getAbsolutePath()), Boolean.toString(isNative), argument == null ? "" : "=" + argument})).start().waitFor() != 0) {
                throw new IllegalStateException("Could not self-attach to current VM using external process");
            }

在我的 Intellij Idea 项目设置、Platfirm 设置和 Gradle 设置中,我安装并选择 11 版本。 请帮我解决这个问题。

我解决了。在@SpringBootApplication class 我有 ReactorDebugAgent.init(); 我不知道,为什么,但是没有 ReactorDebugAgent 它可以工作