在 MacOS X 上使用 Eclipse Mars 进行远程调试 Tomcat 7
Remote Debugging Tomcat 7 with Eclipse Mars on MacOS X
我正在尝试使用 Eclipse 设置远程调试 tomcat。如本answer所述。我在我的 startup.sh
一开始就添加了以下几行(这样 Tomcat 总是以调试模式启动)。
########## Starting Tomcat in Debug mode always #############
JPDA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
catalina.sh jpda start
#############################################################
在 Eclipse 中,我做了以下调试配置:-
但是在调试配置中启动 Eclipse 时出现以下错误:-
Failed to connect to Remote VM. Connection Refused.
环境
Tomcat - 7.0.75
Eclipse - Version: Mars.2 Release (4.5.2)
OS - El Capitan Version 10.11.6 (15G1212)
Java - 1.8.0_77
我还通过执行以下命令检查端口 8000 是否空闲:-
tuk-MacBook-Pro-4:bin tuk$ lsof -n -i -a | grep "8000"
tuk-MacBook-Pro-4:bin tuk$
尝试使用不同的端口,12345
但出现同样的错误。
谁能告诉我我做错了什么以及如何使用带有 Tomcat 7 的 eclipse 进行远程调试?
在我的例子中只是做 catalina.sh jpda start
(我不必设置 JPDA_OPTS
。)并检查 Debug Configuations
-> Remote Java Application
下的 Allow termination of Remote VM
eclipse 解决了这个问题。
我正在尝试使用 Eclipse 设置远程调试 tomcat。如本answer所述。我在我的 startup.sh
一开始就添加了以下几行(这样 Tomcat 总是以调试模式启动)。
########## Starting Tomcat in Debug mode always #############
JPDA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
catalina.sh jpda start
#############################################################
在 Eclipse 中,我做了以下调试配置:-
但是在调试配置中启动 Eclipse 时出现以下错误:-
Failed to connect to Remote VM. Connection Refused.
环境
Tomcat - 7.0.75
Eclipse - Version: Mars.2 Release (4.5.2)
OS - El Capitan Version 10.11.6 (15G1212)
Java - 1.8.0_77
我还通过执行以下命令检查端口 8000 是否空闲:-
tuk-MacBook-Pro-4:bin tuk$ lsof -n -i -a | grep "8000"
tuk-MacBook-Pro-4:bin tuk$
尝试使用不同的端口,12345
但出现同样的错误。
谁能告诉我我做错了什么以及如何使用带有 Tomcat 7 的 eclipse 进行远程调试?
在我的例子中只是做 catalina.sh jpda start
(我不必设置 JPDA_OPTS
。)并检查 Debug Configuations
-> Remote Java Application
下的 Allow termination of Remote VM
eclipse 解决了这个问题。