I am trying to debug some groovy tests using the gradle test runner and get the following error :
Connected to the target VM, address: '127.0.0.1:52063', transport: 'socket'
Disconnected from the target VM, address: '127.0.0.1:52063', transport: 'socket'
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: connect failed: Connection refused
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [debugInit.c:750]
Could not write standard input into: Gradle Test Executor 2.
java.io.IOException: The pipe is being closed
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:326)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:56)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
While running using the "platform test runner" the dubugger works just fine.
I tried a lot of solutions given online but none of them worked. Some solutions that I found and tried which did not work are :
1) Restarting the machine and trying again.
2) Killing the java.exe processes and trying again.
3) checking if firewall was blocking the connection, but firewall is off.
4) pinging localhost, 127.0.0.1 and ::1, all are reachable with 0% packet loss.
Please suggest what could be causing the problem here and how can I solve it.
Edit : Some people might think it is a duplicate of unable-to-debug-in-java-with-eclipse, but my question is different in some ways:
1) That question is about Eclipse IDE and mine is in IntelliJ.
2) Unlike that question I do not get a popup window saying Launching unicodeRead has encountered a problem. Cannot connect to VM
.
3) The other question does not deal with the different nature of the debugger with different test runners, in my situation when i use "platform test runner" the debugger works just fine, but when use "Gradle Test runner" the debugger does not work and throws the above mentioned error.
I tried all the solutions in that link and none of them worked.