Unable to debug a JUnit test in latest IntelliJ Community Edition. I have a couple tests that parse JSON files. The tests build and run successfully.
But trying to debug them fails. It appears IntelliJ CE can’t connect to the JVM the test runs in.
ERROR: transport error 202: connect failed: Operation timed out ERROR:
JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports
initialized
[open/src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c:700]
Details about my IntelliJ CE
IntelliJ IDEA 2024.2 (Community Edition) Build #IC-242.20224.300,
built on August 7, 2024 Runtime version: 21.0.3+13-b509.4 aarch64
(JCEF 122.1.9) VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Kotlin: 242.20224.300-IJ
Details about my MacBook, JDK, and Kotlin:
- macOS 14.3.1
- OpenJDK 22.0.2
- Kotlin 1.9.24 (also fails with 2.0.10)
I don’t think I’ve ever seen this error before from IntelliJ. Also don’t remember having to manually configure IntelliJ for debugging a local unit test before.
Just for the heck of it, I fully removed then re-installed the latest IntelliJ CE. I also upgraded to the latest OpenJDK and removed older JDKs.
Anyone know why I can’t debug with this setup?
Here’s my Maven pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hey.you</groupId>
<artifactId>foo</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.version>2.0.10</kotlin.version>
<!-- kotlin.version>1.9.24</kotlin.version -->
<junit.version>4.13.1</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
<version>2.14.2</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>