Maven Eclipse 调试“JDWP Transport dt_socket 初始化失败,TRANSPORT_INIT(510)”

发布于 2024-12-19 22:50:10 字数 784 浏览 3 评论 0原文

我正在尝试在 Eclipse 中调试 Maven 测试。当我使用 maven 选项 maven.surefire.debug 启动测试时,出现此错误:

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        

与我在 shell 中尝试 tu launch debug 时的情况相同。

我尝试添加 maven 选项 forkMode=never,但我的焊接工件出现了另一个错误,如果没有 maven.surefire.debug 选项,我就不会出现这个错误:

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

但是,Weld 在我的类路径上。

有什么想法吗?

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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(12

始终不够爱げ你 2024-12-26 22:50:10

要终止侦听端口的进程:

此命令应列出侦听所有端口的进程:

netstat -ano

-o 选项将显示进程 ID。

如果您使用的是 *nix 系统,您可以进一步细化:

netstat -ano | grep <badport> 

当您获得进程 ID 时,您可以通过以下方式终止它:

Windows:

  • 打开任务管理器,使用 View > 添加 PID 列选择列 > PID
  • 找到进程右键杀掉

其他:

kill <PID>

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>
眸中客 2024-12-26 22:50:10

对于 Mac 用户:

通常问题是另一个进程使 Maven 调试端口 5005 保持打开状态。
因此,我通过执行以下命令检查了哪个进程保持此端口打开:

lsof -i tcp:5005

输出为:

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

然后我终止了该进程:

kill -9 9089

如果您希望这两个进程能够一起运行,则必须更改至少一个进程的 Maven 调试端口其中。
请参阅: http://maven.apache.org/surefire/maven -surefire-plugin/examples/debugging.html

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.

肤浅与狂妄 2024-12-26 22:50:10

这个问题被问了很长时间,但我最近也遇到了同样的问题。

  1. 打开任务管理器

  2. 终止所有“java.exe”进程

  3. 重新启动 mvn 调试

希望有帮助

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

初见终念 2024-12-26 22:50:10

转到调试配置 -> 远程 Java 应用程序 -> 连接选项卡,选中允许终止远程JVM

然后,当您要重新启动服务器/maven时,转到调试透视图并单击读取/停止按钮......

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

星星的轨迹 2024-12-26 22:50:10

只是为了文档,我在本地运行时遇到了完全相同的错误:

错误:传输错误 202:绑定失败:地址已在使用中
本机方法中出现致命错误:JDWP 未初始化传输,jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
错误:JDWP Transport dt_socket 初始化失败,TRANSPORT_INIT(510)

在我的情况下,端口不是问题,而是主机文件。解决方案是添加/重新添加/取消注释:

127.0.0.1本地主机

配置文件将 localhost 设置为默认主机,因此解决方案是添加该主机或将其更改为自定义主机。

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.

裂开嘴轻声笑有多痛 2024-12-26 22:50:10

补充一下..上周我遇到了类似的问题,当时无法使用 eclipse 进行调试。

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]

遗憾的是,我在网上找到的解决方案都没有帮助。

问题原来是防火墙以某种方式删除了我的 JRE bin 中的所有 dll...(因此 dt_socket.dll 完全丢失)。

重新安装整个 JRE 会有所帮助。

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.

森林迷了鹿 2024-12-26 22:50:10

我的解决方案是删除项目的断点!如果你有很多分支并且最近更改过,有时 Eclipse 会丢失一些断点。

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

病毒体 2024-12-26 22:50:10

首先删除 Eclipse 中的所有调试点

搜索带有服务器端口的 PID
netstat -ano|查找 /i "7001"
中的端口号

将 7001 替换为上行示例 o/p
C:\Users\shaithal>netstat -ano|find /i "7001"
TCP 127.0.0.1:51340 127.0.0.1:7001 SYN_SENT 17396

然后终止该进程
taskkill /F /PID 17396

还使用调试端口搜索 PID
netstat -ano|查找/i“8453”
中的端口号

在我的例子中,8453​​ 是调试端口,将 8453 替换为上面行示例 o/p

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

然后终止该进程
任务终止 /F /PID 19904

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

绅士风度i 2024-12-26 22:50:10

这种奇怪的问题也可能是由VPN连接引起的

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

好久不见√ 2024-12-26 22:50:10

下方添加的主机文件

这是在127.0.0.1 localhost

已修复

it was the host file adding below

127.0.0.1 localhost

fixed

乖乖哒 2024-12-26 22:50:10

就我而言,之前没有打开任何端口,但我使用旧的 java,因此必须使用正确的字符串来附加调试器

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

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

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

最舍不得你 2024-12-26 22:50:10

您可能已经定义了系统范围的JAVA_OPTS,它具有相同的-agentlib部分来启用远程调试器。例如:

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=60740

一旦第二个 Java 进程启动,它将始终侦听与第一个进程相同的端口,在本例中为 60740。

解决方案:

  1. 在运行第二个Java进程之前杀死第一个Java进程,
  2. 不要在JAVA_OPTS中使用-agentlib
  3. 为每个新的Java进程提供新的端口,即新的JAVA_OPTS code> 对于每个 Java 进程。

You may have defined system-wide JAVA_OPTS which have the same -agentlib part to enable remote debugger. For example:

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=60740

once the 2nd Java process launches, it will always listen to the same port as 1st process, which is 60740 in this case.

Solution:

  1. kill 1st Java process before running the 2nd
  2. do not use -agentlib in JAVA_OPTS
  3. provide new port for each new Java process, that is, new JAVA_OPTS for each Java process.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文