Maven Eclipse 调试“JDWP Transport dt_socket 初始化失败,TRANSPORT_INIT(510)”
我正在尝试在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
要终止侦听端口的进程:
此命令应列出侦听所有端口的进程:
-o
选项将显示进程 ID。如果您使用的是 *nix 系统,您可以进一步细化:
当您获得进程 ID 时,您可以通过以下方式终止它:
Windows:
其他:
To kill a process listening on a port:
This command should list processes listening on all ports:
The
-o
option will display the process id.If you're using a *nix system, you can refine a little further with:
When you have the process id, you can terminate it with:
Windows:
Others:
对于 Mac 用户:
通常问题是另一个进程使 Maven 调试端口 5005 保持打开状态。
因此,我通过执行以下命令检查了哪个进程保持此端口打开:
输出为:
然后我终止了该进程:
如果您希望这两个进程能够一起运行,则必须更改至少一个进程的 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:
The output was:
And then I killed the process:
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.
这个问题被问了很长时间,但我最近也遇到了同样的问题。
打开任务管理器
终止所有“java.exe”进程
重新启动 mvn 调试
希望有帮助
There is a long time the question was asked but i had the same problem recently.
Open Task Manager
Kill all "java.exe" process
Relaunch the mvn debug
Hope it will help
转到
调试配置
->远程 Java 应用程序
->连接
选项卡,选中允许终止远程JVM
。然后,当您要重新启动服务器/maven时,转到
调试透视图
并单击读取/停止
按钮......Go to
Debug configuration
->Remote Java Application
->Connect
tab, checkAllow termination of remote JVM
.Then, when you are going to restart the server/maven, go to
Debug perspective
and click theread / stop
button.....只是为了文档,我在本地运行时遇到了完全相同的错误:
在我的情况下,端口不是问题,而是主机文件。解决方案是添加/重新添加/取消注释:
配置文件将 localhost 设置为默认主机,因此解决方案是添加该主机或将其更改为自定义主机。
Just for documentation, I had the exact same error, running on my local:
in my case the port wasn't the issue, but the host file. The solution is to add/re-add/uncomment:
The config file sets
localhost
as default, so a solution is add that host or change it for a custom one.补充一下..上周我遇到了类似的问题,当时无法使用 eclipse 进行调试。
遗憾的是,我在网上找到的解决方案都没有帮助。
问题原来是防火墙以某种方式删除了我的 JRE bin 中的所有 dll...(因此 dt_socket.dll 完全丢失)。
重新安装整个 JRE 会有所帮助。
To add on.. I had the similar issue last week, when debugging using eclipse was made impossible.
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.
我的解决方案是删除项目的断点!如果你有很多分支并且最近更改过,有时 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.
首先删除 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
这种奇怪的问题也可能是由VPN连接引起的
This kind of weird problems can also be caused by VPN connections
下方添加的主机文件
这是在127.0.0.1 localhost
已修复
it was the host file adding below
127.0.0.1 localhost
fixed
就我而言,之前没有打开任何端口,但我使用旧的 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
您可能已经定义了系统范围的
JAVA_OPTS
,它具有相同的-agentlib
部分来启用远程调试器。例如:一旦第二个 Java 进程启动,它将始终侦听与第一个进程相同的端口,在本例中为 60740。
解决方案:
JAVA_OPTS
中使用-agentlib
,JAVA_OPTS
code> 对于每个 Java 进程。You may have defined system-wide
JAVA_OPTS
which have the same-agentlib
part to enable remote debugger. For example:once the 2nd Java process launches, it will always listen to the same port as 1st process, which is 60740 in this case.
Solution:
-agentlib
inJAVA_OPTS
JAVA_OPTS
for each Java process.