IntelliJ运行Spring Boot应用报错:Failed to init Reactor's debug agent
I've run into this exact issue before—your app works fine with mvn spring-boot:run but throws that reactor debug agent error in IntelliJ's run/debug mode, and removing reactor-tools fixes it. Here's what's going on and how to solve it without ditching the dependency:
Why This Happens
The reactor-tools JAR includes a Java agent that needs to be loaded early in the JVM startup process. The Spring Boot Maven plugin automatically handles setting up this agent when you run spring-boot:run, but IntelliJ's default Spring Boot run configuration doesn't add the required JVM argument by default, leading to the initialization failure.
Solutions
1. Add the Java Agent Argument to IntelliJ's Run Configuration
This is the quickest fix for IntelliJ-specific runs:
- Open your Spring Boot run configuration (Run > Edit Configurations...)
- Find the VM options field
- Add the following argument, replacing
{version}with the actual version ofreactor-toolsin yourpom.xml:
(If you're on Windows, use-javaagent:~/.m2/repository/io/projectreactor/reactor-tools/{version}/reactor-tools-{version}.jarC:\Users\{your-user}\.m2\repository\...instead of the~path)
2. Let Spring Boot Auto-Configure the Debug Agent (Recommended)
Spring Boot has built-in support for enabling the Reactor debug agent automatically—you just need to flip a config switch. Add this to your application.properties:
spring.reactor.debug-agent.enabled=true
Or if you use YAML (application.yml):
spring: reactor: debug-agent: enabled: true
This way, Spring Boot will handle loading the agent correctly regardless of whether you start via Maven or IntelliJ, no manual JVM args needed.
3. Configure the Spring Boot Maven Plugin to Pass the Agent
If you prefer to keep your Maven and IntelliJ environments aligned, update your pom.xml to include the agent argument in the Spring Boot plugin:
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <jvmArguments>-javaagent:~/.m2/repository/io/projectreactor/reactor-tools/{version}/reactor-tools-{version}.jar</jvmArguments> </configuration> </plugin> </plugins> </build>
Then, in IntelliJ, use the spring-boot:run Maven goal as your run configuration instead of the default Spring Boot option.
4. Check IntelliJ's Proxy Settings
Occasionally, IntelliJ's HTTP proxy can interfere with the agent's initialization. Head to File > Settings > Appearance & Behavior > System Settings > HTTP Proxy and either:
- Verify your proxy settings are correct (if you need a proxy)
- Temporarily disable the proxy to test if that resolves the issue
Verification
After applying any of these fixes, restart your app via IntelliJ's run/debug mode. If the Failed to init Reactor's debug agent error is gone and your app starts normally, you're good to go!
内容的提问来源于stack exchange,提问作者Alex Yates

