jvm 初始化时抛出非法状态异常

r3i60tvu  于 2022-11-07  发布在  其他
关注(0)|答案(1)|浏览(242)

我正在把应用程序从JVM 8升级到11,我遇到了一些问题。

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

当我尝试运行应用程序时,出现了一个catch 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项目设置,平台设置和Gradle设置我安装并选择11版本。请,帮助我解决这个问题。

ql3eal8s

ql3eal8s1#

我解决了这个问题。在@SpringBootApplication类中,我有ReactorDebugAgent.init();我不知道为什么,但没有ReactorDebugAgent,它就可以工作

相关问题