Maven Eclipse Debug "JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)"
Asked Answered
H

11

37

I'm trying to debug Maven tests in Eclipse. When I launch tests with the maven option maven.surefire.debug, I get this error :

ERROR: transport error 202: bind failed: Address already in use
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690]
/bin/sh: line 1: 27500 Abort trap        

It is the same when I tried tu launch debug in my shell.

I tried to add the maven option forkMode=never, and I get another error with my weld artifact that I do not have without the maven.surefire.debug option :

Error loading Weld bootstrap, check that Weld is on the classpath

However, Weld is on my classpath.

Any ideas ?

Hazelhazelnut answered 8/12, 2011 at 8:46 Comment(3)
I found the solution. The port I used for debug was already in use, probably due to a bug of maven. When using maven.surefire.debug, maven waits on a port. I killed it once, and then retryed to relaunch the maven test. The solution is to close the opened port (I restarted my machine, but there may be a less radical solution...)Titograd
You can post this as your own solution and then accept it a day later.Masterful
@RémiDoolaeghe Can you share the solution. I'm currently facing same error.Sexagenary
T
33

To kill a process listening on a port:

This command should list processes listening on all ports:

netstat -ano

The -o option will display the process id.

If you're using a *nix system, you can refine a little further with:

netstat -ano | grep <badport> 

When you have the process id, you can terminate it with:

Windows:

  • Open Task Manager, add the PID column with View > Select Columns > PID
  • Find the process and right-click to kill it

Others:

kill <PID>
Tinned answered 24/2, 2012 at 13:13 Comment(6)
Sorry, but the -o option is not recognized. I work on a MacOS 10.6. The solution seems to be a good idea, though.Titograd
I think you may be able to get this info on OS X with 'sudo lsof -i -P'Tinned
You are right. sudo lsof -i -P | grep <bad_port> works fine. Thank you.Titograd
In Ubuntu, I add netstat -anop to list out pid.Milldam
If it helps hunting down the correct process to kill, I found the java process in question listening on port 5005. I also see that it was executed as command like java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 -jar xxxxxxMycenae
I'm used to killing the "Java" process, but this time I was tricked because this time the process was called "OpenJDK Platform binary" so I didn't find it by a simple alphabetical sort. This answer helped, thanks.Crackup
S
14

For Mac users:

Usually the problem is that another process keeps Maven debug port 5005 open. So I checked which process keeps this port open by executing:

lsof -i tcp:5005

The output was:

COMMAND  PID        USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    9089 my_user    7u  IPv4 0xe88ec542fd4cffc9      0t0  TCP *:avt-profile-2 (LISTEN)

And then I killed the process:

kill -9 9089

If you want these 2 process to be able to run together, you'll have to change the Maven debug port of at least one of them. See: http://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html.

Superorganic answered 12/6, 2018 at 11:42 Comment(0)
L
6

There is a long time the question was asked but i had the same problem recently.

  1. Open Task Manager

  2. Kill all "java.exe" process

  3. Relaunch the mvn debug

Hope it will help

Letreece answered 10/12, 2015 at 14:9 Comment(0)
S
5

Go to Debug configuration -> Remote Java Application -> Connect tab, check Allow termination of remote JVM.

Then, when you are going to restart the server/maven, go to Debug perspective and click the read / stop button.....

Sleepwalk answered 8/9, 2012 at 22:28 Comment(0)
W
3

Just for documentation, I had the exact same error, running on my local:

ERROR: transport error 202: bind failed: Address already in use FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197) ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)

in my case the port wasn't the issue, but the host file. The solution is to add/re-add/uncomment:

127.0.0.1 localhost

The config file sets localhost as default, so a solution is add that host or change it for a custom one.

Welldressed answered 3/4, 2018 at 15:52 Comment(0)
F
1

To add on.. I had the similar issue last week, when debugging using eclipse was made impossible.

FATAL ERROR in native method: JDWP No transports initialized,
jvmtiError=AGENT_ERROR_TRANSPORT_LOAD(196)
ERROR: transport library not found: dt_socket
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_LOAD(509)
JDWP exit error AGENT_ERROR_TRANSPORT_LOAD(196): No transports initialized [../../../src/share/back/debugInit.c:690]

Sadly non of the solution I can possibly find online was helpful.

The issue turned out to be that somehow firewall removed all the dlls in my JRE bin... (so dt_socket.dll went completely missing).

Reinstalling the entire JRE helped.

Fearless answered 23/12, 2013 at 7:59 Comment(0)
A
1

The solution to me was removing the breakpoints of project! If you have many branches and changed recently sometimes eclipse lost some's breakpoints.

Anatomical answered 26/5, 2017 at 20:21 Comment(1)
this actually is helpful, I was struggling for weeks, was able to only run not debugCop
F
1

first of all remove all debug points in eclipse

search for PID with server port
netstat -ano|find /i "7001"
replace 7001 with your port number in above line

sample o/p C:\Users\shaithal>netstat -ano|find /i "7001" TCP 127.0.0.1:51340 127.0.0.1:7001 SYN_SENT 17396

then kill that process taskkill /F /PID 17396

search for PID with debug port also netstat -ano|find /i "8453" 8453 is debug port in my case replace 8453 with your port number in above line

sample o/p

C:\Users\shaithal>netstat -ano|find /i "8453" TCP 0.0.0.0:8453 0.0.0.0:0 LISTENING 19904

then kill that process taskkill /F /PID 19904

Footle answered 8/7, 2020 at 13:21 Comment(0)
R
0

it was the host file adding below

127.0.0.1 localhost

fixed

Rosinarosinante answered 15/8, 2023 at 18:43 Comment(0)
W
0

This kind of weird problems can also be caused by VPN connections

Wane answered 2/1 at 16:35 Comment(0)
C
0

in my case no port was open before, but I used old java so had to use the correct string for attaching debugger

New java: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005

Old java: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005

Cropper answered 16/7 at 17:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.