Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 ?

like image 664
Rémi Doolaeghe Avatar asked Dec 08 '11 08:12

Rémi Doolaeghe


4 Answers

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>
like image 166
lucrussell Avatar answered Nov 08 '22 08:11

lucrussell


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.

like image 43
ofirbt Avatar answered Nov 08 '22 07:11

ofirbt


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.....

like image 5
Jasonw Avatar answered Nov 08 '22 07:11

Jasonw


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

like image 5
moa Avatar answered Nov 08 '22 08:11

moa